diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 0bbb2507a..700e61cfb 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -26,9 +26,9 @@ jobs: go-version: stable - name: Run golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v7 with: - version: v1.64.8 + version: v2.1.2 skip-cache: true skip-save-cache: true args: --timeout=5m --config=.golangci.yml diff --git a/.golangci.yml b/.golangci.yml index ea8097fc8..8bd6d02b9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,71 +1,89 @@ -# Config file for golangci-lint +version: "2" run: concurrency: 4 + modules-download-mode: readonly issues-exit-code: 1 tests: true - modules-download-mode: readonly - output: formats: - - format: colored-line-number + text: path: stdout - print-issued-lines: true - print-linter-name: true - + print-linter-name: true + print-issued-lines: true linters: - disable-all: true + default: none enable: - # - errcheck - forbidigo - - goimports - - gosimple - govet - ineffassign - # - maligned - misspell - # - prealloc - staticcheck - # - unparam - unused - -linters-settings: - errcheck: - check-type-assertions: false - check-blank: false - forbidigo: - forbid: - - ^fmt\.Print(f|ln)?$ - govet: - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - misspell: - locale: US - unparam: - check-exported: false - prealloc: - simple: true - range-loops: true - for-loops: true - -issues: - exclude-dirs: - - .github - - doc - - docker - - logos - - scripts - - util - exclude-rules: - - path: "main.go" # Excludes main usage - linters: [forbidigo] - - source: "nats-server: v%s" # Excludes PrintServerAndExit - linters: [forbidigo] - - path: "server/opts.go" # Excludes TLS usage options - linters: [forbidigo] - - path: "_test.go" # Excludes unit tests - linters: [forbidigo] + settings: + errcheck: + check-type-assertions: false + check-blank: false + forbidigo: + forbid: + - pattern: ^fmt\.Print(f|ln)?$ + govet: + settings: + printf: + funcs: + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf + misspell: + locale: US + staticcheck: + checks: + - all + - -QF* + - -ST1003 + - -ST1016 + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - forbidigo + path: main.go + - linters: + - forbidigo + source: "nats-server: v%s" + - linters: + - forbidigo + path: server/opts.go + - linters: + - forbidigo + path: _test.go + paths: + - .github + - doc + - docker + - logos + - scripts + - util + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - goimports + exclusions: + generated: lax + paths: + - .github + - doc + - docker + - logos + - scripts + - util + - third_party$ + - builtin$ + - examples$