From 20a21f27f8bdf4efd858bcd401fe4dddd60a1bb5 Mon Sep 17 00:00:00 2001 From: pilinux Date: Sun, 25 Aug 2024 12:23:03 +0200 Subject: [PATCH] fix warning: (SA1006) go-staticcheck printf-style function with dynamic format string and no further arguments should use print-style function instead --- .github/workflows/golangci-lint.yml | 2 +- config/config.go | 3 +-- lib/middleware/jwt.go | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 3a98816..2cd7eef 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -40,7 +40,7 @@ jobs: uses: golangci/golangci-lint-action@v6 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.59.1 + version: v1.60.3 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/config/config.go b/config/config.go index 16fc50b..e916d14 100644 --- a/config/config.go +++ b/config/config.go @@ -7,7 +7,6 @@ import ( "crypto" "crypto/sha256" "errors" - "fmt" "net/http" "os" "path/filepath" @@ -383,7 +382,7 @@ func security() (securityConfig SecurityConfig, err error) { cipherKey := strings.TrimSpace(os.Getenv("CIPHER_KEY")) if cipherKey == "" { - err = fmt.Errorf("CIPHER_KEY is missing") + err = errors.New("CIPHER_KEY is missing") return } cipherKeyHash2 := sha256.Sum256([]byte(cipherKey)) // sha2-256 diff --git a/lib/middleware/jwt.go b/lib/middleware/jwt.go index a311dd0..609337a 100644 --- a/lib/middleware/jwt.go +++ b/lib/middleware/jwt.go @@ -7,6 +7,7 @@ package middleware import ( "crypto/ecdsa" "crypto/rsa" + "errors" "fmt" "net/http" "strings" @@ -277,7 +278,7 @@ func GetJWT(customClaims MyCustomClaims, tokenType string) (string, string, erro ttl = JWTParams.RefreshKeyTTL nbf = JWTParams.RefNbf default: - return "", "", fmt.Errorf("invalid token type") + return "", "", errors.New("invalid token type") } // Create the Claims