build: migrate golangci-lint config to v2

This commit is contained in:
tr1sm0s1n 2025-03-31 11:00:57 +05:30
parent 1d3f258ebb
commit 14db050bd7
No known key found for this signature in database
GPG key ID: 0F30FF07CAB2F87A

View file

@ -1,31 +1,25 @@
# This file configures github.com/golangci/golangci-lint. # This file configures github.com/golangci/golangci-lint.
version: '2'
run: run:
timeout: 20m
tests: true tests: true
linters: linters:
disable-all: true default: none
enable: enable:
- goimports
- gosimple
- govet
- ineffassign
- misspell
- unconvert
- typecheck
- unused
- staticcheck
- bidichk - bidichk
- durationcheck
- copyloopvar - copyloopvar
- whitespace
- revive # only certain checks enabled
- durationcheck - durationcheck
- gocheckcompilerdirectives - gocheckcompilerdirectives
- reassign - govet
- ineffassign
- mirror - mirror
- misspell
- reassign
- revive # only certain checks enabled
- staticcheck
- unconvert
- unused
- usetesting - usetesting
- whitespace
### linters we tried and will not be using: ### linters we tried and will not be using:
### ###
# - structcheck # lots of false positives # - structcheck # lots of false positives
@ -36,44 +30,67 @@ linters:
# - exhaustive # silly check # - exhaustive # silly check
# - makezero # false positives # - makezero # false positives
# - nilerr # several intentional # - nilerr # several intentional
settings:
linters-settings: staticcheck:
gofmt: checks:
simplify: true # disable Quickfixes
revive: - -QF1*
enable-all-rules: false revive:
# here we enable specific useful rules enable-all-rules: false
# see https://golangci-lint.run/usage/linters/#revive for supported rules # here we enable specific useful rules
# see https://golangci-lint.run/usage/linters/#revive for supported rules
rules:
- name: receiver-naming
severity: warning
disabled: false
exclude:
- ''
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules: rules:
- name: receiver-naming - linters:
severity: warning - deadcode
disabled: false - staticcheck
exclude: [""] path: crypto/bn256/cloudflare/optate.go
- linters:
issues: - revive
# default is true. Enables skipping of directories: path: crypto/bn256/
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - path: cmd/utils/flags.go
exclude-dirs-use-default: true text: "SA1019: cfg.TxLookupLimit is deprecated: use 'TransactionHistory' instead."
exclude-files: - path: cmd/utils/flags.go
- core/genesis_alloc.go text: "SA1019: ethconfig.Defaults.TxLookupLimit is deprecated: use 'TransactionHistory' instead."
exclude-rules: - path: internal/build/pgp.go
- path: crypto/bn256/cloudflare/optate.go text: 'SA1019: "golang.org/x/crypto/openpgp" is deprecated: this package is unmaintained except for security fixes.'
linters: - path: core/vm/contracts.go
- deadcode text: 'SA1019: "golang.org/x/crypto/ripemd160" is deprecated: RIPEMD-160 is a legacy hash and should not be used for new applications.'
- staticcheck - path: (.+)\.go$
- path: crypto/bn256/ text: 'SA1019: event.TypeMux is deprecated: use Feed'
linters: - path: (.+)\.go$
- revive text: 'SA1019: strings.Title is deprecated'
- path: cmd/utils/flags.go - path: (.+)\.go$
text: "SA1019: cfg.TxLookupLimit is deprecated: use 'TransactionHistory' instead." text: 'SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.'
- path: cmd/utils/flags.go - path: (.+)\.go$
text: "SA1019: ethconfig.Defaults.TxLookupLimit is deprecated: use 'TransactionHistory' instead." text: 'SA1029: should not use built-in type string as key for value'
- path: internal/build/pgp.go paths:
text: 'SA1019: "golang.org/x/crypto/openpgp" is deprecated: this package is unmaintained except for security fixes.' - core/genesis_alloc.go
- path: core/vm/contracts.go - third_party$
text: 'SA1019: "golang.org/x/crypto/ripemd160" is deprecated: RIPEMD-160 is a legacy hash and should not be used for new applications.' - builtin$
exclude: - examples$
- 'SA1019: event.TypeMux is deprecated: use Feed' formatters:
- 'SA1019: strings.Title is deprecated' enable:
- 'SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.' - goimports
- 'SA1029: should not use built-in type string as key for value' settings:
gofmt:
simplify: true
exclusions:
generated: lax
paths:
- core/genesis_alloc.go
- third_party$
- builtin$
- examples$