all: fix staticcheck warnings (#589)

Co-authored-by: Filippo Valsorda <github@bip.filippo.io>
This commit is contained in:
Alexander Yastrebov
2024-12-18 15:55:57 +01:00
committed by GitHub
parent 176e245b3c
commit cda3988cc7
4 changed files with 3 additions and 6 deletions

View File

@@ -158,5 +158,5 @@ func errorf(format string, v ...interface{}) {
} }
func warning(msg string) { func warning(msg string) {
log.Printf("age-keygen: warning: " + msg) log.Printf("age-keygen: warning: %s", msg)
} }

View File

@@ -201,7 +201,7 @@ func (r *StanzaReader) ReadStanza() (s *Stanza, err error) {
b, err := DecodeString(strings.TrimSuffix(string(line), "\n")) b, err := DecodeString(strings.TrimSuffix(string(line), "\n"))
if err != nil { if err != nil {
if bytes.HasPrefix(line, footerPrefix) || bytes.HasPrefix(line, stanzaPrefix) { if bytes.HasPrefix(line, footerPrefix) || bytes.HasPrefix(line, stanzaPrefix) {
return nil, fmt.Errorf("malformed body line %q: stanza ended without a short line\nNote: this might be a file encrypted with an old beta version of age or rage. Use age v1.0.0-beta6 or rage to decrypt it.", line) return nil, fmt.Errorf("malformed body line %q: stanza ended without a short line\nnote: this might be a file encrypted with an old beta version of age or rage; use age v1.0.0-beta6 or rage to decrypt it", line)
} }
return nil, errorf("malformed body line %q: %v", line, err) return nil, errorf("malformed body line %q: %v", line, err)
} }

View File

@@ -12,7 +12,6 @@ import (
"io" "io"
"golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/chacha20poly1305"
"golang.org/x/crypto/poly1305"
) )
const ChunkSize = 64 * 1024 const ChunkSize = 64 * 1024
@@ -29,7 +28,7 @@ type Reader struct {
} }
const ( const (
encChunkSize = ChunkSize + poly1305.TagSize encChunkSize = ChunkSize + chacha20poly1305.Overhead
lastChunkFlag = 0x01 lastChunkFlag = 0x01
) )

View File

@@ -9,7 +9,6 @@ package plugin
import ( import (
"bufio" "bufio"
"bytes"
"fmt" "fmt"
"io" "io"
"math/rand" "math/rand"
@@ -382,7 +381,6 @@ type clientConnection struct {
cmd *exec.Cmd cmd *exec.Cmd
io.Reader // stdout io.Reader // stdout
io.Writer // stdin io.Writer // stdin
stderr bytes.Buffer
close func() close func()
} }