diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b748ffb..ec5c140 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: go-version: 1.17 - name: Lint - uses: golangci/golangci-lint-action@v6.5.0 + uses: golangci/golangci-lint-action@v7.0.0 with: version: latest args: --timeout 5m diff --git a/.golangci.yml b/.golangci.yml index 3ff1d0c..3bd9c66 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,94 +1,99 @@ -linters-settings: - govet: - shadow: true - golint: - min-confidence: 0 - gocyclo: - min-complexity: 15 - maligned: - suggest-new: true - dupl: - threshold: 100 - goconst: - min-len: 2 - min-occurrences: 3 - misspell: - locale: US - lll: - line-length: 140 - goimports: - local-prefixes: github.com/ernado/ige - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - hugeParam - - rangeValCopy - - exitAfterDefer - - whyNoLint - - singleCaseSwitch - +version: "2" linters: - disable-all: true + default: none enable: - dogsled - dupl - errcheck + - gochecknoglobals - gochecknoinits + - gocognit - goconst - gocritic - gocyclo - - gofmt - - goimports - gosec - - gosimple - govet - ineffassign - lll - misspell - nakedret - staticcheck - - stylecheck - - typecheck - unconvert - unparam - unused - whitespace - - gochecknoglobals - - gocognit - - # Do not enable: - # - wsl (too opinionated about newlines) - # - godox (todos are OK) - # - bodyclose (false positives on helper functions) - # - prealloc (not worth it in scope of this project) - # - maligned (same as prealloc) - # - funlen (gocyclo is enough) - -issues: - exclude: - - "xor - result 0 \\(int\\) is never used" - exclude-rules: - # Disable linters that are annoying in tests. - - path: _test\.go - linters: - - gocyclo - - errcheck - - dupl - - gosec - - funlen - - goconst - - gocognit - - scopelint - - lll - - gochecknoglobals - # Ignore shadowing of err. - - linters: [govet] - text: 'declaration of "err"' - # Ignore linters in main packages. - - path: main\.go - linters: [gochecknoglobals, goconst, funlen, gocognit, gocyclo] + settings: + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + disabled-checks: + - hugeParam + - rangeValCopy + - exitAfterDefer + - whyNoLint + - singleCaseSwitch + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + gocyclo: + min-complexity: 15 + lll: + line-length: 140 + misspell: + locale: US + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - dupl + - errcheck + - funlen + - gochecknoglobals + - gocognit + - goconst + - gocyclo + - gosec + - lll + - scopelint + path: _test\.go + - linters: + - govet + text: declaration of "err" + - linters: + - funlen + - gochecknoglobals + - gocognit + - goconst + - gocyclo + path: main\.go + - path: (.+)\.go$ + text: xor - result 0 \(int\) is never used + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + settings: + goimports: + local-prefixes: + - github.com/ernado/ige + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$