Opinionated golangci-lint configuration. Intentionally strict (but not draconian) to surface bugs, security issues, and style problems early while avoiding the noisiest checks.
It was originally published as a popular github gist
- Copy
.golangci.ymlto the root of your Go module. - Set
formatters.settings.goimports.local-prefixesto your module path (for example,github.com/acme/service). - Run
golangci-lint run ./...from the project root.
- Tags mirror the matching golangci-lint releases; a few versions may be missing.
- This keeps it friendly to automation tools such as updatecli.
- Adjust the module prefix (
formatters.settings.goimports.local-prefixes). - Toggle linters or tune their settings to match your risk tolerance.
- Refine
linters.exclusions.rules. - Optional extras are marked with
## you may want to enable; uncomment what you need.
- Every supported linter and formatter is listed, with disabled ones commented for quick discovery.
- Each entry includes a short comment explaining its purpose.
- Only non-default options appear here; full defaults live in .golangci.reference.yml.
- Common false positives are pre-collected under
linters.exclusions.rules.
MIT License. See LICENSE for details.