.golangci.yml: switch to list of enabled linters

Instead of enabling all linters, and when disabling some of them because
we don't like them, switch to list of explicitly enabled linters. The
upside of this is we can easily upgrade golangci-lint (i.e. any new
linters won't break our CI). The downside is, we need to explicitly
enable extra linters.

To me, this is better from the maintainability perspective.

NOTE this commit does not change the configuration in any way, in other
words, the list of linters being run is the same as before. The next
commit will address this.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2025-03-27 12:13:28 -07:00
parent 827dbaefcf
commit c72526cd9c
2 changed files with 60 additions and 59 deletions

View File

@ -3,4 +3,4 @@
skip = bin,vendor,.git,go.sum,.cirrus.yml,"*.fish,RELEASE_NOTES.md,*.xz,*.gz,*.ps1,*.tar,swagger.yaml,*.tgz,bin2img,*ico,*.png,*.1,*.5,copyimg,*.orig,apidoc.go
check-hidden = true
ignore-regex = \b(Not|assert)In\b
ignore-words-list = ddress,secon,passt,bu,hastable,te,clos,ans,pullrequest,uint,iff,od,seeked,splitted,marge,erro,hist,ether,specif,whit
ignore-words-list = ddress,secon,passt,bu,hastable,te,clos,ans,pullrequest,uint,iff,od,seeked,splitted,marge,erro,hist,ether,specif,whit,decorder

View File

@ -4,64 +4,65 @@ run:
timeout: 5m
modules-download-mode: readonly
linters:
enable-all: true
disable:
# too many reports but requires attention
- depguard
- intrange # should be turned on but we have to convert each place manually as there is no auto fix function
- tagalign
- perfsprint
- typecheck
# useful hints that should be addressed
- testifylint # all of reports that should be fixed
- nakedret
- gosmopolitan # usage of time.Local in pkg/k8s.io
- tagliatelle # too many JSON keys cannot be changed due to compat
- dupword # too many false positives (e.g., in tests)
- gocognit
- testpackage
- err113
- errorlint
- wrapcheck
- paralleltest
- wsl
- godox
- tparallel
- nlreturn
- noctx
- nestif
- predeclared
- thelper
- forbidigo
- exhaustive
- gofumpt
- gci
- godot
- dupl
- funlen
- gochecknoglobals
- gochecknoinits
- goconst
- gocyclo
- lll
- gosec
- musttag # way to many warnings to fix for now, also some false positives
- mnd # way to many false positives
- gomoddirectives
- containedctx
- contextcheck
- cyclop
- canonicalheader # our current header values are fixed and should not be changed
- errname
- forcetypeassert
- ireturn
- varnamelen
- maintidx
- nilnil
- nonamedreturns
- exhaustruct
# deprecated linters
- tenv
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- copyloopvar
- decorder
- dogsled
- durationcheck
- errcheck
- errchkjson
- exptostd
- fatcontext
- ginkgolinter
- gocheckcompilerdirectives
- gochecksumtype
- gocritic
- gofmt
- goheader
- goimports
- gomodguard
- goprintffuncname
- gosimple
- govet
- grouper
- iface
- importas
- inamedparam
- ineffassign
- interfacebloat
- loggercheck
- makezero
- mirror
- misspell
- nilerr
- nilnesserr
- nolintlint
- nosprintfhostport
- prealloc
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
- testableexamples
- unconvert
- unparam
- unused
- usestdlibvars
- usetesting
- wastedassign
- whitespace
- zerologlint
linters-settings:
errcheck:
check-blank: false