To see a list of supported linters and which linters are enabled/disabled:
Enabled by Default
| Name | Description | Presets | AutoFix | Since | 
|---|---|---|---|---|
| errcheck ⚙️ | Errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases. | bugs, error | v1.0.0 | |
| gosimple ⚙️ | Linter for Go source code that specializes in simplifying code. | style | v1.20.0 | |
| govet ⚙️ | Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string. | bugs, metalinter | v1.0.0 | |
| Detects when assignments to existing variables are not used. | unused | v1.0.0 | ||
| It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. | bugs, metalinter | v1.0.0 | ||
| unused ⚙️ | Checks Go code for unused constants, variables, functions and types. | unused | v1.20.0 | 
Disabled by Default
ErrErrorfnilzerologSendMsgLinters Configuration
asasalint
Check for pass []any as any in variadic func(...any).
bidichk
Checks for dangerous unicode character sequences.
cyclop
Checks function and package cyclomatic complexity.
decorder
Check declaration order and count of types, constants, variables and functions.
depguard
Go linter that checks if package imports are in a list of acceptable packages.
dogsled
Checks assignments with too many blank identifiers (e.g. x, , , _, := f()).
dupl
Tool for code clone detection.
dupword
Checks for duplicate words in the source code.
errcheck
Errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases.
errchkjson
Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted.
errorlint
Errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
exhaustive
Check exhaustiveness of enum switch statements.
exhaustivestruct
The owner seems to have abandoned the linter. Replaced by exhaustruct.
exhaustruct
Checks if all structure fields are initialized.
forbidigo
Forbids identifiers.
funlen
Tool for detection of long functions.
gci
Gci controls Go package import order and makes it always deterministic.
ginkgolinter
Enforces standards of using ginkgo and gomega.
gocognit
Computes and checks the cognitive complexity of functions.
goconst
Finds repeated strings that could be replaced by a constant.
gocritic
Provides diagnostics that check for bugs, performance and style issues.
Extensible without recompilation through dynamic rules.
Dynamic rules are written declaratively with AST patterns, filters, report message and optional suggestion.
gocyclo
Computes and checks the cyclomatic complexity of functions.
godot
Check if comments end in a period.
godox
Tool for detection of FIXME, TODO and other comment keywords.
gofmt
Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification.
gofumpt
Gofumpt checks whether code was gofumpt-ed.
goheader
Checks is file header matches to pattern.
goimports
Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode.
golint
The repository of the linter has been archived by the owner. Replaced by revive.
gomnd
An analyzer to detect magic numbers.
gomoddirectives
Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
gomodguard
Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
gosimple
Linter for Go source code that specializes in simplifying code.
gosec
Inspects source code for security problems.
gosmopolitan
Report certain i18n/l10n anti-patterns in your Go codebase.
govet
Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.
grouper
An analyzer to analyze expression groups.
ifshort
The repository of the linter has been deprecated by the owner.
importas
Enforces consistent import aliases.
interfacebloat
A linter that checks the number of methods inside an interface.
ireturn
Accept Interfaces, Return Concrete Types.
lll
Reports long lines.
loggercheck
Checks key value pairs for common logger libraries (kitlog,klog,logr,zap).
maintidx
Maintidx measures the maintainability index of each function.
makezero
Finds slice declarations with non-zero initial length.
maligned
The repository of the linter has been archived by the owner. Replaced by govet 'fieldalignment'.
misspell
Finds commonly misspelled English words in comments.
musttag
Enforce field tags in (un)marshaled structs.
nakedret
Finds naked returns in functions greater than a specified function length.
nestif
Reports deeply nested if statements.
nilnil
nil
nlreturn
Nlreturn checks for a new line before return and branch statements to increase code clarity.
nolintlint
Reports ill-formed or insufficient nolint directives.
nonamedreturns
Reports all named returns.
paralleltest
Paralleltest detects missing usage of t.Parallel() method in your Go test.
prealloc
Finds slice declarations that could potentially be pre-allocated.
predeclared
Find code that shadows one of Go's predeclared identifiers.
promlinter
Check Prometheus metrics naming via promlint.
reassign
Checks that package variables are not reassigned.
revive
Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
rowserrcheck
Checks whether Err of rows is checked successfully.
staticcheck
It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint.
stylecheck
Stylecheck is a replacement for golint.
tagalign
Check that struct tags are well aligned.
tagliatelle
Checks the struct tags.
tenv
Tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17.
testifylint
Checks usage of github.com/stretchr/testify.
testpackage
Linter that makes you use a separate _test package.
thelper
Thelper detects Go test helpers without t.Helper() call and checks the consistency of test helpers.
usestdlibvars
A linter that detect the possibility to use variables/constants from the Go standard library.
unparam
Reports unused function parameters.
unused
Checks Go code for unused constants, variables, functions and types.
varcheck
The owner seems to have abandoned the linter. Replaced by unused.
varnamelen
Checks that the length of a variable's name matches its scope.
whitespace
Tool for detection of leading and trailing whitespace.
wrapcheck
Checks that errors returned from external packages are wrapped.
wsl
Whitespace Linter - Forces you to use empty lines!.
custom
Edit this page on GitHub
