.golangci.yml
linters:
enable:
- bodyclose
- dogsled
- dupl
- errcheck
- errorlint
- exportloopref
- forcetypeassert
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gofmt
- goimports
- gomnd
- gomoddirectives
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- nestif
- prealloc
- rowserrcheck
- staticcheck
- stylecheck
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- whitespace
- wrapcheck
linters-settings:
dupl:
threshold: 100
errcheck:
check-blank: true
gocognit:
min-complexity: 15
gocyclo:
min-complexity: 10
nakedret:
max-func-lines: 0
goconst:
min-occurrences: 3
golint:
min-confidence: 0
issues:
exclude-rules:
- path: main.go
linters:
- gochecknoglobals # global in main.go needed for testing
- path: cmd/
linters:
- dupl # CLIs are a lot of similar-looking code!
- wrapcheck # errors don't need to be wrapped in thin CLIs
- path: _test.go
linters:
- dupl # many functions in tests look like duplicates
- funlen # test function can be very long due to test cases
- gochecknoglobals # globals in tests are fine
- gocognit # test functions can be long/complex
- goconst # there are many magic numbers in tests
- gomnd # there are many magic numbers in tests
- wrapcheck # errors don't need to be wrapped in tests
- path: example_*_test.go
linters:
- errcheck # not required to check errors in examples
- ineffassign # not required to check errors in examples