Skip to content

Commit

Permalink
Fix staticcheck warnings
Browse files Browse the repository at this point in the history
$ 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)

$ gotip vet ./cmd/...
cmd/age-keygen/keygen.go:161:13: non-constant format string in call to log.Printf
  • Loading branch information
AlexanderYastrebov committed Sep 15, 2024
1 parent 176e245 commit 4ec1617
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/age-keygen/keygen.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,5 @@ func errorf(format string, v ...interface{}) {
}

func warning(msg string) {
log.Printf("age-keygen: warning: " + msg)
log.Printf("age-keygen: warning: %s", msg)
}
2 changes: 1 addition & 1 deletion internal/format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (r *StanzaReader) ReadStanza() (s *Stanza, err error) {
b, err := DecodeString(strings.TrimSuffix(string(line), "\n"))
if err != nil {
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)
}
Expand Down
3 changes: 1 addition & 2 deletions internal/stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"io"

"golang.org/x/crypto/chacha20poly1305"
"golang.org/x/crypto/poly1305"
)

const ChunkSize = 64 * 1024
Expand All @@ -29,7 +28,7 @@ type Reader struct {
}

const (
encChunkSize = ChunkSize + poly1305.TagSize
encChunkSize = ChunkSize + chacha20poly1305.Overhead
lastChunkFlag = 0x01
)

Expand Down
2 changes: 0 additions & 2 deletions plugin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package plugin

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

Expand Down

0 comments on commit 4ec1617

Please sign in to comment.