Skip to content

golangci-lint: upgrade to v2 schema #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/pre-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ jobs:
run: make build-oct

- name: Golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v7
with:
version: v1.64
args: --timeout 10m0s

- name: make vet
Expand Down
157 changes: 75 additions & 82 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,106 +1,99 @@
linters-settings:
dupl:
threshold: 100
funlen:
lines: 60
statements: 45
goconst:
min-len: 4
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- whyNoLint
gocyclo:
min-complexity: 20
goimports:
local-prefixes: github.com/golangci/golangci-lint
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
lll:
line-length: 250
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: false # do not require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped
version: "2"
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
default: none
enable:
- bodyclose
- copyloopvar
- dogsled
- errcheck
- exhaustive
- copyloopvar
- funlen
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- mnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- mnd
- nolintlint
- revive
- rowserrcheck
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace
# do not enable:
# - asciicheck
# - depguard
# - dupl
# - gochecknoglobals
# - gochecknoinits
# - gocognit
# - godot
# - godox
# - goerr113
# - nakedret
# - nestif
# - noctx
# - prealloc
# - copyloopvar
# - structcheck
# - testpackage
# - wsl
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Ignore magic numbers, inline strings and function length in tests.
- path: _test\.go
linters:
- mnd
- goconst
- funlen
# Ignore line length for string assignments (do not try and wrap regex definitions)
- linters:
- lll
source: "^(.*= (\".*\"|`.*`))$"
# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
text: "unnecessaryDefer:"
# Ignore static strings in tests
settings:
dupl:
threshold: 100
funlen:
lines: 60
statements: 45
goconst:
min-len: 4
min-occurrences: 2
gocritic:
disabled-checks:
- whyNoLint
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
gocyclo:
min-complexity: 20
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
lll:
line-length: 250
nolintlint:
require-explanation: false
require-specific: true
allow-unused: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- funlen
- goconst
- mnd
path: _test\.go
- linters:
- lll
source: ^(.*= (".*"|`.*`))$
- linters:
- gocritic
text: 'unnecessaryDefer:'
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- github.com/golangci/golangci-lint
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$