You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use go/packages instead of x/tools/loader: it allows to work
with go modules and speedups loading of packages with the help
of build cache.
A lot of linters became "fast": they are enabled by --fast now and
work in 1-2 seconds. Only unparam, interfacer and megacheck
are "slow" linters now.
Average project is analyzed 20-40% faster than before if all linters are
enabled! If we enable all linters except unparam, interfacer and
megacheck analysis is 10-20x faster!
Copy file name to clipboardExpand all lines: README.md
+19-28Lines changed: 19 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,16 +113,16 @@ GolangCI-Lint can be used with zero configuration. By default the following lint
113
113
```
114
114
$ golangci-lint help linters
115
115
Enabled by default linters:
116
-
govet: Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false]
117
-
errcheck: Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false]
116
+
govet: Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true]
117
+
errcheck: Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: true]
118
118
staticcheck: Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false]
119
119
unused: Checks Go code for unused constants, variables, functions and types [fast: false]
120
120
gosimple: Linter for Go source code that specializes in simplifying a code [fast: false]
121
-
structcheck: Finds an unused struct fields [fast: false]
122
-
varcheck: Finds unused global variables and constants [fast: false]
121
+
structcheck: Finds an unused struct fields [fast: true]
122
+
varcheck: Finds unused global variables and constants [fast: true]
123
123
ineffassign: Detects when assignments to existing variables are not used [fast: true]
124
-
deadcode: Finds unused code [fast: false]
125
-
typecheck: Like the front-end of a Go compiler, parses and type-checks Go code [fast: false]
124
+
deadcode: Finds unused code [fast: true]
125
+
typecheck: Like the front-end of a Go compiler, parses and type-checks Go code [fast: true]
126
126
```
127
127
128
128
and the following linters are disabled by default:
@@ -131,17 +131,17 @@ $ golangci-lint help linters
131
131
...
132
132
Disabled by default linters:
133
133
golint: Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: true]
134
-
gosec (gas): Inspects source code for security problems [fast: false]
134
+
gosec (gas): Inspects source code for security problems [fast: true]
135
135
interfacer: Linter that suggests narrower interface types [fast: false]
136
-
unconvert: Remove unnecessary type conversions [fast: false]
136
+
unconvert: Remove unnecessary type conversions [fast: true]
137
137
dupl: Tool for code clone detection [fast: true]
138
138
goconst: Finds repeated strings that could be replaced by a constant [fast: true]
139
139
gocyclo: Computes and checks the cyclomatic complexity of functions [fast: true]
140
140
gofmt: Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true]
141
141
goimports: Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true]
142
-
maligned: Tool to detect Go structs that would take less memory if their fields were sorted [fast: false]
142
+
maligned: Tool to detect Go structs that would take less memory if their fields were sorted [fast: true]
143
143
megacheck: 3 sub-linters in one: unused, gosimple and staticcheck [fast: false]
144
-
depguard: Go linter that checks if package imports are in a list of acceptable packages [fast: false]
144
+
depguard: Go linter that checks if package imports are in a list of acceptable packages [fast: true]
145
145
misspell: Finds commonly misspelled English words in comments [fast: true]
146
146
lll: Reports long lines [fast: true]
147
147
unparam: Reports unused function parameters [fast: false]
@@ -372,7 +372,7 @@ Flags:
372
372
--enable-all Enable all linters
373
373
--disable-all Disable all linters
374
374
-p, --presets strings Enable presets (bugs|unused|format|style|complexity|performance) of linters. Run 'golangci-lint linters' to see them. This option implies option --disable-all
375
-
--fast Run only fast linters from enabled linters set
375
+
--fast Run only fast linters from enabled linters set (first run won't be fast)
376
376
-e, --exclude strings Exclude issue by regexp
377
377
--exclude-use-default Use or not use default excludes:
378
378
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
@@ -502,20 +502,6 @@ linters-settings:
502
502
govet:
503
503
# report about shadowed variables
504
504
check-shadowing: true
505
-
506
-
# Obtain type information from installed (to $GOPATH/pkg) package files:
507
-
# golangci-lint will execute `go install -i` and `go test -i` for analyzed packages
508
-
# before analyzing them.
509
-
# By default this option is disabled and govet gets type information by loader from source code.
510
-
# Loading from source code is slow, but it's done only once for all linters.
511
-
# Go-installing of packages first time is much slower than loading them from source code,
512
-
# therefore this option is disabled by default.
513
-
# But repeated installation is fast in go >= 1.10 because of build caching.
514
-
# Enable this option only if all conditions are met:
515
-
# 1. you use only "fast" linters (--fast e.g.): no program loading occurs
516
-
# 2. you use go >= 1.10
517
-
# 3. you do repeated runs (false for CI) or cache $GOPATH/pkg or `go env GOCACHE` dir in CI.
518
-
use-installed-packages: false
519
505
golint:
520
506
# minimal confidence for issues, default is 0.8
521
507
min-confidence: 0.8
@@ -657,6 +643,8 @@ linters-settings:
657
643
- github.com/sirupsen/logrus
658
644
misspell:
659
645
locale: US
646
+
lll:
647
+
line-length: 140
660
648
661
649
linters:
662
650
enable-all: true
@@ -701,9 +689,7 @@ We don't recommend vendoring `golangci-lint` in your repo: you will get troubles
701
689
702
690
**Does I need to run `go install`?**
703
691
704
-
No, you don't need to do it anymore. We will run `go install -i` and `go test -i`
705
-
for analyzed packages ourselves. We will run them only
706
-
if option `govet.use-installed-packages` is `true`.
692
+
No, you don't need to do it anymore.
707
693
708
694
**Which go versions are supported**
709
695
Golangci-lint versions > 1.10.2 supports Go 1.10 and 1.11.
0 commit comments