Table of Contents
To see a list of supported linters and which linters are enabled/disabled:
golangci-lint help linters
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 | ||
ineffassign | Detects when assignments to existing variables are not used. | unused | v1.0.0 | ||
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. | bugs, metalinter | v1.0.0 | ||
unused ⚙️ | Checks Go code for unused constants, variables, functions and types. | unused | v1.20.0 |
Disabled by Default
Name | Description | Presets | AutoFix | Since | |
---|---|---|---|---|---|
asasalint ⚙️ | Check for pass []any as any in variadic func(...any). | bugs | 1.47.0 | ||
asciicheck | Checks that all code identifiers does not have non-ASCII symbols in the name. | bugs, style | v1.26.0 | ||
bidichk ⚙️ | Checks for dangerous unicode character sequences. | bugs | 1.43.0 | ||
bodyclose | Checks whether HTTP response body is closed successfully. | performance, bugs | v1.18.0 | ||
containedctx | Containedctx is a linter that detects struct contained context.Context field. | style | 1.44.0 | ||
contextcheck | Check whether the function uses a non-inherited context. | bugs | v1.43.0 | ||
cyclop ⚙️ | Checks function and package cyclomatic complexity. | complexity | v1.37.0 | ||
deadcode ⚠ | The owner seems to have abandoned the linter. Replaced by unused. | unused | v1.0.0 | ||
decorder ⚙️ | Check declaration order and count of types, constants, variables and functions. | format, style | v1.44.0 | ||
depguard ⚙️ | Go linter that checks if package imports are in a list of acceptable packages. | style, import, module | v1.4.0 | ||
dogsled ⚙️ | Checks assignments with too many blank identifiers (e.g. x, , , _, := f()). | style | v1.19.0 | ||
dupl ⚙️ | Tool for code clone detection. | style | v1.0.0 | ||
dupword ⚙️ | Checks for duplicate words in the source code. | comment | ✔ | 1.50.0 | |
durationcheck | Check for two durations multiplied together. | bugs | v1.37.0 | ||
errchkjson ⚙️ | Checks types passed to the json encoding functions. Reports unsupported types and reports occations, where the check for the returned error can be omitted. | bugs | 1.44.0 | ||
errname | Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error . | style | v1.42.0 | ||
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. | bugs, error | v1.32.0 | ||
execinquery | Execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds. | sql | v1.46.0 | ||
exhaustive ⚙️ | Check exhaustiveness of enum switch statements. | bugs | v1.28.0 | ||
exhaustivestruct ⚙️ ⚠ | The owner seems to have abandoned the linter. Replaced by exhaustruct. | style, test | v1.32.0 | ||
exhaustruct ⚙️ | Checks if all structure fields are initialized. | style, test | v1.46.0 | ||
exportloopref | Checks for pointers to enclosing loop variables. | bugs | v1.28.0 | ||
forbidigo ⚙️ | Forbids identifiers. | style | v1.34.0 | ||
forcetypeassert | Finds forced type assertions. | style | v1.38.0 | ||
funlen ⚙️ | Tool for detection of long functions. | complexity | v1.18.0 | ||
gci ⚙️ | Gci controls Go package import order and makes it always deterministic. | format, import | v1.30.0 | ||
ginkgolinter ⚙️ | Enforces standards of using ginkgo and gomega. | style | v1.51.0 | ||
gocheckcompilerdirectives | Checks that go compiler directive comments (//go:) are valid. | bugs | v1.51.0 | ||
gochecknoglobals | Check that no global variables exist This analyzer checks for global variables and errors on any found. A global variable is a variable declared in package scope and that can be read and written to by any function within the package. Global variables can cause side effects which are difficult to keep track of. A code in one function may change the variables state while another unrelated chunk of code may be effected by it. | style | v1.12.0 | ||
gochecknoinits | Checks that no init functions are present in Go code. | style | v1.12.0 | ||
gochecksumtype | Run exhaustiveness checks on Go "sum types". | bugs | v1.55.0 | ||
gocognit ⚙️ | Computes and checks the cognitive complexity of functions. | complexity | v1.20.0 | ||
goconst ⚙️ | Finds repeated strings that could be replaced by a constant. | style | v1.0.0 | ||
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. | style, metalinter | v1.12.0 | ||
gocyclo ⚙️ | Computes and checks the cyclomatic complexity of functions. | complexity | v1.0.0 | ||
godot ⚙️ | Check if comments end in a period. | style, comment | ✔ | v1.25.0 | |
godox ⚙️ | Tool for detection of FIXME, TODO and other comment keywords. | style, comment | v1.19.0 | ||
goerr113 | Go linter to check the errors handling expressions. | style, error | v1.26.0 | ||
gofmt ⚙️ | Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification. | format | ✔ | v1.0.0 | |
gofumpt ⚙️ | Gofumpt checks whether code was gofumpt-ed. | format | ✔ | v1.28.0 | |
goheader ⚙️ | Checks is file header matches to pattern. | style | v1.28.0 | ||
goimports ⚙️ | Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode. | format, import | ✔ | v1.20.0 | |
golint ⚙️ ⚠ | The repository of the linter has been archived by the owner. Replaced by revive. | style | v1.0.0 | ||
gomnd ⚙️ | An analyzer to detect magic numbers. | style | v1.22.0 | ||
gomoddirectives ⚙️ | Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. | style, module | v1.39.0 | ||
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. | style, import, module | v1.25.0 | ||
goprintffuncname | Checks that printf-like functions are named with f at the end. | style | v1.23.0 | ||
gosec ⚙️ | Inspects source code for security problems. | bugs | v1.0.0 | ||
gosmopolitan ⚙️ | Report certain i18n/l10n anti-patterns in your Go codebase. | bugs | v1.53.0 | ||
grouper ⚙️ | Analyze expression groups. | style | v1.44.0 | ||
ifshort ⚙️ ⚠ | The repository of the linter has been deprecated by the owner. | style | v1.36.0 | ||
importas ⚙️ | Enforces consistent import aliases. | style | v1.38.0 | ||
inamedparam | Reports interfaces with unnamed method parameters. | style | v1.55.0 | ||
interfacebloat ⚙️ | A linter that checks the number of methods inside an interface. | style | v1.49.0 | ||
interfacer ⚠ | The repository of the linter has been archived by the owner. | style | v1.0.0 | ||
ireturn ⚙️ | Accept Interfaces, Return Concrete Types. | style | v1.43.0 | ||
lll ⚙️ | Reports long lines. | style | v1.8.0 | ||
loggercheck ⚙️ | Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). | style, bugs | v1.49.0 | ||
maintidx ⚙️ | Maintidx measures the maintainability index of each function. | complexity | v1.44.0 | ||
makezero |