Last active
July 31, 2025 16:03
-
-
Save cristaloleg/dc29ca0ef2fb554de28d94c3c6f6dc88 to your computer and use it in GitHub Desktop.
An opinionated golangci-lint config (right version™)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $ golangci-lint run --config=~/.golangci.yml ./... > lint.txt | |
version: "2" | |
linters: | |
enable: | |
- asasalint | |
- asciicheck | |
- bidichk | |
- bodyclose | |
- canonicalheader | |
- contextcheck | |
- copyloopvar | |
- durationcheck | |
- errname | |
- errorlint | |
- exptostd | |
- gocritic | |
- godot | |
- gomoddirectives | |
- gosec | |
- misspell | |
- nakedret | |
- nilerr | |
- nilnesserr | |
- nilnil | |
- noctx | |
- nolintlint | |
- prealloc | |
- predeclared | |
- reassign | |
- revive | |
- rowserrcheck | |
- sqlclosecheck | |
- staticcheck | |
- tagliatelle | |
- testableexamples | |
- thelper | |
- tparallel | |
- unconvert | |
- unparam | |
- usestdlibvars | |
- usetesting | |
- wastedassign | |
disable: | |
- containedctx | |
- cyclop | |
- decorder | |
- depguard | |
- dogsled | |
- dupl | |
- dupword | |
- err113 | |
- errchkjson | |
- exhaustive | |
- exhaustruct | |
- forbidigo | |
- forcetypeassert | |
- funlen | |
- ginkgolinter | |
- gocheckcompilerdirectives | |
- gochecknoglobals | |
- gochecknoinits | |
- gocognit | |
- goconst | |
- gocyclo | |
- godox | |
- goheader | |
- gomodguard | |
- goprintffuncname | |
- grouper | |
- importas | |
- interfacebloat | |
- intrange | |
- ireturn | |
- lll | |
- loggercheck | |
- maintidx | |
- makezero | |
- mirror | |
- mnd | |
- musttag | |
- nestif | |
- nlreturn | |
- nonamedreturns | |
- nosprintfhostport | |
- paralleltest | |
- promlinter | |
- protogetter | |
- recvcheck | |
- spancheck | |
- testifylint | |
- testpackage | |
- varnamelen | |
- whitespace | |
- wrapcheck | |
- wsl | |
- zerologlint | |
settings: | |
errcheck: | |
check-type-assertions: true | |
check-blank: true | |
exclude-functions: | |
- io/ioutil.ReadFile | |
- io.Copy(*bytes.Buffer) | |
- io.Copy(os.Stdout) | |
gocritic: | |
disabled-checks: | |
- hugeParam | |
- rangeExprCopy | |
- rangeValCopy | |
enabled-tags: | |
- diagnostic | |
- experimental | |
- opinionated | |
- performance | |
- style | |
govet: | |
disable: | |
- fieldalignment | |
nakedret: | |
max-func-lines: 1 | |
tagliatelle: | |
case: | |
rules: | |
avro: snake | |
bson: camel | |
json: snake | |
mapstructure: kebab | |
xml: camel | |
yaml: snake | |
exclusions: | |
generated: lax | |
presets: | |
- comments | |
- common-false-positives | |
- legacy | |
- std-error-handling | |
paths: | |
- third_party$ | |
- builtin$ | |
- examples$ | |
issues: | |
max-issues-per-linter: 0 | |
max-same-issues: 0 | |
new: false | |
fix: false | |
formatters: | |
enable: | |
- gofmt | |
- gofumpt | |
- goimports | |
exclusions: | |
generated: lax | |
paths: | |
- third_party$ | |
- builtin$ | |
- examples$ | |
run: | |
go: "" | |
build-tags: | |
- integration | |
modules-download-mode: readonly | |
# exit code when at least one issue was found, default is 1 | |
issues-exit-code: 1 | |
# include test files or not, default is true | |
tests: true | |
# Allow multiple parallel golangci-lint instances running. | |
# If false (default) - golangci-lint acquires file lock on start. | |
allow-parallel-runners: false | |
output: | |
path-prefix: "" | |
print-issued-lines: false | |
sort-order: | |
- linter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@cristaloleg thank you a lot!