summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2024-09-28 11:30:40 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2024-09-28 11:33:24 +0200
commit48aba2f0c40662186ff5d49dcca44ce563b365fd (patch)
tree33e029b69ae899ad55b3e397f91a50c3a4147010
parent2d6e6fad45057b829e84375e914e3301c4bd73ba (diff)
chore: Lintsv0.5.0
-rwxr-xr-x.githooks/pre-commit10
-rw-r--r--cmd/cvet/check_command.go3
-rw-r--r--kauth/crypto.go2
-rw-r--r--tools.go10
4 files changed, 17 insertions, 8 deletions
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"
+)