From c3951bea9e5b63f47bbc170f50e19d3ae7755c58 Mon Sep 17 00:00:00 2001 From: Umputun Date: Mon, 9 Dec 2024 13:28:57 -0600 Subject: [PATCH] lint: update linter config and address minor warns --- .github/workflows/ci.yml | 2 +- .golangci.yml | 32 +++++++++++++++++++++----------- basic_auth.go | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d434e4f..f66d911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: latest + version: v1.61 - name: install goveralls run: | diff --git a/.golangci.yml b/.golangci.yml index bb57842..ec36f9d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,11 +1,11 @@ +run: + timeout: 5m + tests: false + linters-settings: govet: enable: - shadow - gocyclo: - min-complexity: 15 - dupl: - threshold: 100 goconst: min-len: 2 min-occurrences: 2 @@ -20,17 +20,19 @@ linters-settings: - experimental disabled-checks: - wrapperFunc + - hugeParam + - rangeValCopy + - singleCaseSwitch + - ifElseChain linters: enable: - - staticcheck - - gosimple - revive - govet - unconvert + - staticcheck - unused - gosec - - gocyclo - dupl - misspell - unparam @@ -38,19 +40,27 @@ linters: - ineffassign - stylecheck - gochecknoinits - - exportloopref + - copyloopvar - gocritic - nakedret + - gosimple - prealloc fast: false disable-all: true issues: + exclude-dirs: + - vendor exclude-rules: - - text: 'Deferring unsafe method "Close" on type "io.ReadCloser"' + - text: "at least one file in a package should have a package comment" linters: - - gosec + - stylecheck + - text: "should have a package comment" + linters: + - revive - path: _test\.go linters: + - gosec - dupl - exclude-use-default: false \ No newline at end of file + exclude-use-default: false + diff --git a/basic_auth.go b/basic_auth.go index 8eb8399..4c4aa99 100644 --- a/basic_auth.go +++ b/basic_auth.go @@ -123,7 +123,7 @@ func GenerateBcryptHash(password string) (string, error) { } // GenerateArgon2Hash generates an argon2 hash and salt from a password -func GenerateArgon2Hash(password string) (hash string, salt string, err error) { +func GenerateArgon2Hash(password string) (hash, salt string, err error) { saltBytes := make([]byte, 16) if _, err := rand.Read(saltBytes); err != nil { return "", "", err