Skip to content
/ template Public template

Commit 3bb6897

Browse files
committed
chore: simplify golangci-lint configuration by enabling all not explicitly disabled linters
1 parent d6bf6e2 commit 3bb6897

File tree

1 file changed

+3
-82
lines changed

1 file changed

+3
-82
lines changed

.golangci.yml

Lines changed: 3 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -12,85 +12,7 @@ run:
1212
timeout: 3m
1313

1414
linters:
15-
enable:
16-
- errcheck # check for unchecked errors
17-
- gosimple # specializes in simplifying code
18-
- govet # roughly the same as go vet
19-
- ineffassign # detects when assignments to existing variables are not used
20-
- staticcheck # staticcheck is a go vet on steroids, applying static analysis to your code
21-
- unused # finds unused variables and constants
22-
- asasalint # check `any` variadic funcs
23-
- asciicheck # check for non-ASCII characters
24-
- bidichk # check for dangerous unicode character sequences
25-
- bodyclose # check that HTTP response body is closed
26-
- canonicalheader # check that canonical headers are used
27-
- containedctx # detects struct contained context.Context field
28-
- contextcheck # check whether the function uses a non-inherited context
29-
- decorder # check declaration order and count of types, constants, variables and functions
30-
- dupl # finds duplicated code
31-
- durationcheck # check for two durations multiplied together
32-
- err113 # check the errors handling expressions
33-
- errchkjson # checks types passed to the json encoding functions
34-
- errname # check error names
35-
- errorlint # check error wrapping
36-
- exhaustive # check that all enum cases are handled
37-
- exportloopref # checks for pointers to enclosing loop variables
38-
- fatcontext # detects nested contexts in loops
39-
- forcetypeassert # finds unchecked type assertions
40-
- funlen # check for long functions
41-
- gci # controls Go package import order and makes it always deterministic
42-
- gocheckcompilerdirectives # checks that go compiler directive comments (//go:) are valid
43-
- gochecksumtype # exhaustiveness checks on Go "sum types"
44-
- gocognit # check for high cognitive complexity
45-
- gocritic # Go source code linter that provides a ton of rules
46-
- gocyclo # checks cyclomatic complexity
47-
- gofmt # checks whether code was gofmt-ed
48-
- gofumpt # checks whether code was gofumpt-ed
49-
- goimports # check import statements are formatted according to the 'goimport' command
50-
- goprintffuncname # checks that printf-like functions are named with f at the end
51-
- gosec # inspects source code for security problems
52-
- gosmopolitan # report certain i18n/l10n anti-patterns in your Go codebase
53-
- inamedparam # reports interfaces with unnamed method parameters
54-
- interfacebloat # check for large interfaces
55-
- intrange # find places where for loops could make use of an integer range
56-
- lll # check for long lines
57-
- maintidx # measures the maintainability index of each function
58-
- mirror # reports wrong mirror patterns of bytes/strings usage
59-
- misspell # finds commonly misspelled English words
60-
- musttag # enforce field tags in (un)marshaled structs
61-
- nakedret # checks that functions with naked returns are not longer than a maximum size
62-
- nestif # reports deeply nested if statements
63-
- nilerr # finds code that returns nil even if it checks that the error is not nil
64-
- nilnil # checks that there is no simultaneous return of nil error and an invalid value
65-
- nlreturn # checks for a new line before return and branch statements to increase code clarity
66-
- nolintlint # reports ill-formed or insufficient nolint directives
67-
- nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
68-
- paralleltest # detects missing usage of t.Parallel() method in your Go test
69-
- perfsprint # checks that fmt.Sprintf can be replaced with a faster alternative
70-
- prealloc # finds slice declarations that could potentially be pre-allocated
71-
- predeclared # finds code that shadows one of Go's predeclared identifiers
72-
- promlinter # checks Prometheus metrics naming via promlint
73-
- protogetter # reports direct reads from proto message fields when getters should be used
74-
- reassign # checks that package variables are not reassigned
75-
- revive # drop-in replacement of golint.
76-
- rowserrcheck # checks whether Rows.Err of rows is checked successfully
77-
- sloglint # ensures consistent code style when using log/slog
78-
- spancheck # checks for mistakes with OpenTelemetry/Census spans
79-
- sqlclosecheck # checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed
80-
- stylecheck # replacement for golint
81-
- tagalign # checks that struct tags are well aligned
82-
- tagliatelle # checks the struct tags
83-
- tenv # analyzer that detects using os.Setenv instead of t.Setenv
84-
- thelper # detects tests helpers which is not start with t.Helper() method
85-
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
86-
- unconvert # unnecessary type conversions
87-
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
88-
- varnamelen # checks that the length of a variable's name matches its scope
89-
- wastedassign # finds wasted assignment statements
90-
- whitespace # checks for unnecessary newlines at the start and end of functions, if, for, etc
91-
- wrapcheck # checks that errors returned from external packages are wrapped
92-
- wsl # add or remove empty lines
93-
15+
enable-all: true
9416
disable:
9517
- copyloopvar # fixed in go 1.22+
9618
- depguard # no forbidden imports
@@ -116,13 +38,12 @@ linters:
11638
- testifylint # testify is not recommended
11739
- testpackage # not a go best practice
11840
- unparam # interfaces can enforce parameters
119-
- zerologlint # slog should be used instead of zerlog
120-
- execinquery # deprecated
121-
- gomnd # deprecated
41+
- zerologlint # slog should be used instead of zerolog
12242
- mnd # too many detections
12343
- cyclop # covered by gocyclo
12444
- gochecknoglobals # there are many valid reasons for global variables, depending on the project
12545
- ireturn # there are too many exceptions
46+
- tenv # deprecated
12647

12748
linters-settings:
12849
wsl:

0 commit comments

Comments
 (0)