Last active
April 1, 2025 15:26
-
-
Save manuelarte/76c3cedb1f819184a9a880883e6edd5f to your computer and use it in GitHub Desktop.
golanci-lint v2
This file contains 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
version: "2" | |
run: | |
relative-path-mode: gomod | |
linters: | |
default: none | |
enable: | |
- asasalint | |
- asciicheck | |
- bidichk | |
- bodyclose | |
- canonicalheader | |
- copyloopvar | |
- cyclop | |
- depguard | |
- dupl | |
- durationcheck | |
- errcheck | |
- errname | |
- errorlint | |
- exhaustive | |
- exptostd | |
- fatcontext | |
- forbidigo | |
- funlen | |
- gocheckcompilerdirectives | |
- gochecknoglobals | |
- gochecknoinits | |
- gochecksumtype | |
- gocognit | |
- goconst | |
- gocritic | |
- gocyclo | |
- godot | |
- gomoddirectives | |
- goprintffuncname | |
- gosec | |
- govet | |
- iface | |
- ineffassign | |
- intrange | |
- lll | |
- loggercheck | |
- makezero | |
- mirror | |
- mnd | |
- musttag | |
- nakedret | |
- nestif | |
- nilerr | |
- nilnesserr | |
- nilnil | |
- noctx | |
- nolintlint | |
- nonamedreturns | |
- nosprintfhostport | |
- perfsprint | |
- predeclared | |
- promlinter | |
- protogetter | |
- reassign | |
- recvcheck | |
- revive | |
- rowserrcheck | |
- sloglint | |
- spancheck | |
- sqlclosecheck | |
- staticcheck | |
- testableexamples | |
- testifylint | |
- testpackage | |
- tparallel | |
- unconvert | |
- unparam | |
- unused | |
- usestdlibvars | |
- usetesting | |
- wastedassign | |
- whitespace | |
settings: | |
cyclop: | |
max-complexity: 30 | |
package-average: 10 | |
depguard: | |
rules: | |
deprecated: | |
files: | |
- $all | |
deny: | |
- pkg: github.com/golang/protobuf | |
desc: Use google.golang.org/protobuf instead, see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules | |
- pkg: github.com/satori/go.uuid | |
desc: Use github.com/google/uuid instead, satori's package is not maintained | |
- pkg: github.com/gofrs/uuid$ | |
desc: Use github.com/gofrs/uuid/v5 or later, it was not a go module before v5 | |
non-main files: | |
files: | |
- '!**/main.go' | |
deny: | |
- pkg: log$ | |
desc: Use log/slog instead, see https://go.dev/blog/slog | |
non-test files: | |
files: | |
- '!$test' | |
deny: | |
- pkg: math/rand$ | |
desc: Use math/rand/v2 instead, see https://go.dev/blog/randv2 | |
errcheck: | |
check-type-assertions: true | |
exhaustive: | |
check: | |
- switch | |
- map | |
exhaustruct: | |
exclude: | |
- ^net/http.Client$ | |
- ^net/http.Cookie$ | |
- ^net/http.Request$ | |
- ^net/http.Response$ | |
- ^net/http.Server$ | |
- ^net/http.Transport$ | |
- ^net/url.URL$ | |
- ^os/exec.Cmd$ | |
- ^reflect.StructField$ | |
- ^github.com/Shopify/sarama.Config$ | |
- ^github.com/Shopify/sarama.ProducerMessage$ | |
- ^github.com/mitchellh/mapstructure.DecoderConfig$ | |
- ^github.com/prometheus/client_golang/.+Opts$ | |
- ^github.com/spf13/cobra.Command$ | |
- ^github.com/spf13/cobra.CompletionOptions$ | |
- ^github.com/stretchr/testify/mock.Mock$ | |
- ^github.com/testcontainers/testcontainers-go.+Request$ | |
- ^github.com/testcontainers/testcontainers-go.FromDockerfile$ | |
- ^golang.org/x/tools/go/analysis.Analyzer$ | |
- ^google.golang.org/protobuf/.+Options$ | |
- ^gopkg.in/yaml.v3.Node$ | |
funlen: | |
lines: 100 | |
statements: 50 | |
ignore-comments: true | |
gocognit: | |
min-complexity: 20 | |
gochecksumtype: | |
default-signifies-exhaustive: false | |
gocritic: | |
settings: | |
captLocal: | |
paramsOnly: false | |
underef: | |
skipRecvDeref: false | |
govet: | |
disable: | |
- fieldalignment | |
enable-all: true | |
settings: | |
shadow: | |
strict: true | |
inamedparam: | |
skip-single-param: true | |
mnd: | |
ignored-functions: | |
- args.Error | |
- flag.Arg | |
- flag.Duration.* | |
- flag.Float.* | |
- flag.Int.* | |
- flag.Uint.* | |
- os.Chmod | |
- os.Mkdir.* | |
- os.OpenFile | |
- os.WriteFile | |
- prometheus.ExponentialBuckets.* | |
- prometheus.LinearBuckets | |
nolintlint: | |
require-explanation: true | |
require-specific: true | |
allow-no-explanation: | |
- funlen | |
- gocognit | |
- lll | |
perfsprint: | |
strconcat: false | |
reassign: | |
patterns: | |
- .* | |
rowserrcheck: | |
packages: | |
- github.com/jmoiron/sqlx | |
sloglint: | |
no-global: all | |
context: scope | |
usetesting: | |
os-temp-dir: true | |
exclusions: | |
generated: lax | |
presets: | |
- comments | |
- common-false-positives | |
- legacy | |
- std-error-handling | |
rules: | |
- linters: | |
- godot | |
source: (noinspection|TODO) | |
- linters: | |
- gocritic | |
source: //noinspection | |
- linters: | |
- bodyclose | |
- dupl | |
- errcheck | |
- funlen | |
- goconst | |
- gosec | |
- noctx | |
- wrapcheck | |
path: _test\.go | |
paths: | |
- third_party$ | |
- builtin$ | |
- examples$ | |
issues: | |
max-same-issues: 50 | |
formatters: | |
enable: | |
- gofmt | |
- gci | |
settings: | |
gofmt: | |
simplify: true | |
rewrite-rules: | |
- pattern: 'interface{}' | |
replacement: 'any' | |
gci: | |
sections: | |
- standard | |
- default | |
- localmodule |
Small comment, this .golangci-lint
is the result of running golangci-lint migrate
on: https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Thanks for that