diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 36f6357..e74b64c 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -4,9 +4,9 @@ set -ev gofmt -d -e -s . go vet ./... go run github.com/martinlehoux/kagamigo/cmd/cvet ./... -staticcheck ./... -gosec -quiet ./... -gocyclo -over 10 -ignore '.*_templ\.go' . -golangci-lint run +go run honnef.co/go/tools/cmd/staticcheck ./... +go run github.com/securego/gosec/v2/cmd/gosec -quiet ./... +go run github.com/fzipp/gocyclo/cmd/gocyclo -over 10 -ignore '.*_templ\.go' . +go run github.com/golangci/golangci-lint/cmd/golangci-lint run go test ./... -go mod tidy \ No newline at end of file +go mod tidy diff --git a/cmd/cvet/check_command.go b/cmd/cvet/check_command.go index 15f17f5..a2fc11a 100644 --- a/cmd/cvet/check_command.go +++ b/cmd/cvet/check_command.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "go/ast" "go/token" "strings" @@ -37,7 +36,7 @@ func loggerCommandKeyValueArgFinder(pass *analysis.Pass, commandName string) fun value := secondArg.Value[1 : len(secondArg.Value)-1] if value != commandName { - pass.Reportf(arg.Pos(), fmt.Sprintf("logger command name must be function name %s, but found %s", commandName, value)) + pass.Reportf(arg.Pos(), "logger command name must be function name %s, but found %s", commandName, value) return true } return true diff --git a/kauth/crypto.go b/kauth/crypto.go index 702c9a7..117076d 100644 --- a/kauth/crypto.go +++ b/kauth/crypto.go @@ -45,7 +45,7 @@ func decrypt(secret []byte, encryptedText string) (string, error) { return "", ErrEncryptedTooShort } nonce, cipherText := encryptedBytes[:nonceSize], encryptedBytes[nonceSize:] - plainBytes, err := aead.Open(nil, nonce, cipherText, nil) + plainBytes, err := aead.Open(nil, nonce, cipherText, nil) // #nosec G407 if err != nil { err = kcore.Wrap(err, "error decrypting") return "", err diff --git a/tools.go b/tools.go new file mode 100644 index 0000000..80599d2 --- /dev/null +++ b/tools.go @@ -0,0 +1,10 @@ +//go:build tools + +package main + +import ( + _ "github.com/fzipp/gocyclo/cmd/gocyclo" + _ "github.com/golangci/golangci-lint/cmd/golangci-lint" + _ "github.com/securego/gosec/v2/cmd/gosec" + _ "honnef.co/go/tools/cmd/staticcheck" +)