Skip to content

Commit 24353a3

Browse files
Fix staticcheck warnings
$ staticcheck ./... | fmt -w 80 -s internal/format/format.go:204:17: error strings should not end with punctuation or newlines (ST1005) internal/stream/stream.go:15:2: "golang.org/x/crypto/poly1305" is deprecated: Poly1305 as implemented by this package is a cryptographic building block that is not safe for general purpose use. For encryption, use the full ChaCha20-Poly1305 construction implemented by golang.org/x/crypto/chacha20poly1305. For authentication, use a general purpose MAC such as HMAC implemented by crypto/hmac. (SA1019) plugin/client.go:385:2: field stderr is unused (U1000)
1 parent 176e245 commit 24353a3

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

internal/format/format.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (r *StanzaReader) ReadStanza() (s *Stanza, err error) {
201201
b, err := DecodeString(strings.TrimSuffix(string(line), "\n"))
202202
if err != nil {
203203
if bytes.HasPrefix(line, footerPrefix) || bytes.HasPrefix(line, stanzaPrefix) {
204-
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)
204+
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)
205205
}
206206
return nil, errorf("malformed body line %q: %v", line, err)
207207
}

internal/stream/stream.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"io"
1313

1414
"golang.org/x/crypto/chacha20poly1305"
15-
"golang.org/x/crypto/poly1305"
1615
)
1716

1817
const ChunkSize = 64 * 1024
@@ -29,7 +28,7 @@ type Reader struct {
2928
}
3029

3130
const (
32-
encChunkSize = ChunkSize + poly1305.TagSize
31+
encChunkSize = ChunkSize + chacha20poly1305.Overhead
3332
lastChunkFlag = 0x01
3433
)
3534

plugin/client.go

-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package plugin
99

1010
import (
1111
"bufio"
12-
"bytes"
1312
"fmt"
1413
"io"
1514
"math/rand"
@@ -382,7 +381,6 @@ type clientConnection struct {
382381
cmd *exec.Cmd
383382
io.Reader // stdout
384383
io.Writer // stdin
385-
stderr bytes.Buffer
386384
close func()
387385
}
388386

0 commit comments

Comments
 (0)