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
Copy file name to clipboardExpand all lines: README.md
+57-64Lines changed: 57 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,34 +77,35 @@ GolangCI-Lint can be used with zero configuration. By default next linters are e
77
77
```
78
78
$ golangci-lint linters
79
79
Enabled by default linters:
80
-
govet: Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
81
-
errcheck: Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
82
-
staticcheck: Staticcheck is go vet on steroids, applying a ton of static analysis checks
83
-
unused: Checks Go code for unused constants, variables, functions and types
84
-
gosimple: Linter for Go source code that specialises on simplifying code
85
-
gas: Inspects source code for security problems
86
-
structcheck: Finds unused struct fields
87
-
varcheck: Finds unused global variables and constants
88
-
ineffassign: Detects when assignments to existing variables are not used
89
-
deadcode: Finds unused code
80
+
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]
81
+
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]
82
+
staticcheck: Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false]
83
+
unused: Checks Go code for unused constants, variables, functions and types [fast: false]
84
+
gosimple: Linter for Go source code that specializes in simplifying a code [fast: false]
85
+
gas: Inspects source code for security problems [fast: false]
86
+
structcheck: Finds an unused struct fields [fast: false]
87
+
varcheck: Finds unused global variables and constants [fast: false]
88
+
ineffassign: Detects when assignments to existing variables are not used [fast: true]
89
+
deadcode: Finds unused code [fast: false]
90
+
typecheck: Like the front-end of a Go compiler, parses and type-checks Go code [fast: false]
90
91
```
91
92
92
93
and next linters are disabled by default:
93
94
```
94
95
$ golangci-lint linters
95
96
...
96
97
Disabled by default linters:
97
-
golint: Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
98
-
interfacer: Linter that suggests narrower interface types
99
-
unconvert: Remove unnecessary type conversions
100
-
dupl: Tool for code clone detection
101
-
goconst: Finds repeated strings that could be replaced by a constant
102
-
gocyclo: Computes and checks the cyclomatic complexity of functions
103
-
gofmt: Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
104
-
goimports: Goimports does everything that gofmt does. Additionally it checks unused imports
105
-
maligned: Tool to detect Go structs that would take less memory if their fields were sorted
106
-
megacheck: 3 sub-linters in one: unused, gosimple and staticcheck
107
-
depguard: Go linter that checks if package imports are in a list of acceptable packages
98
+
golint: Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: true]
99
+
interfacer: Linter that suggests narrower interface types [fast: false]
100
+
unconvert: Remove unnecessary type conversions [fast: false]
101
+
dupl: Tool for code clone detection [fast: true]
102
+
goconst: Finds repeated strings that could be replaced by a constant [fast: true]
103
+
gocyclo: Computes and checks the cyclomatic complexity of functions [fast: true]
104
+
gofmt: Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true]
105
+
goimports: Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true]
106
+
maligned: Tool to detect Go structs that would take less memory if their fields were sorted [fast: false]
107
+
megacheck: 3 sub-linters in one: unused, gosimple and staticcheck [fast: false]
108
+
depguard: Go linter that checks if package imports are in a list of acceptable packages [fast: false]
108
109
```
109
110
110
111
Pass `-E/--enable` to enable linter and `-D/--disable` to disable:
@@ -174,30 +175,30 @@ golangci-lint linters
174
175
```
175
176
176
177
## Enabled By Default Linters
177
-
-[go vet](https://golang.org/cmd/vet/) - Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
178
-
-[errcheck](https://github.com/kisielk/errcheck): Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
179
-
-[staticcheck](https://staticcheck.io/): Staticcheck is a go vet on steroids, applying a ton of static analysis checks
180
-
-[unused](https://github.com/dominikh/go-tools/tree/master/cmd/unused): Checks Go code for unused constants, variables, functions, and types
181
-
-[gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple): Linter for Go source code that specializes in simplifying a code
182
-
-[gas](https://github.com/GoASTScanner/gas): Inspects source code for security problems
183
-
-[structcheck](https://github.com/opennota/check): Finds an unused struct fields
184
-
-[varcheck](https://github.com/opennota/check): Finds unused global variables and constants
185
-
-[ineffassign](https://github.com/gordonklaus/ineffassign): Detects when assignments to existing variables are not used
- typecheck: Like the front-end of a Go compiler, parses and type-checks Go code. Similar to [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype).
178
+
-[govet](https://golang.org/cmd/vet/) - Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
179
+
-[errcheck](https://github.com/kisielk/errcheck) - Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
180
+
-[staticcheck](https://staticcheck.io/) - Staticcheck is a go vet on steroids, applying a ton of static analysis checks
181
+
-[unused](https://github.com/dominikh/go-tools/tree/master/cmd/unused) - Checks Go code for unused constants, variables, functions and types
182
+
-[gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) - Linter for Go source code that specializes in simplifying a code
183
+
-[gas](https://github.com/GoASTScanner/gas) - Inspects source code for security problems
184
+
-[structcheck](https://github.com/opennota/check) - Finds an unused struct fields
185
+
-[varcheck](https://github.com/opennota/check) - Finds unused global variables and constants
186
+
-[ineffassign](https://github.com/gordonklaus/ineffassign) - Detects when assignments to existing variables are not used
- typecheck - Like the front-end of a Go compiler, parses and type-checks Go code
188
189
189
190
## Disabled By Default Linters (`-E/--enable`)
190
-
-[golint](https://github.com/golang/lint): Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
191
-
-[interfacer](https://github.com/mvdan/interfacer): Linter that suggests narrower interface types
192
-
-[unconvert](https://github.com/mdempsky/unconvert): Remove unnecessary type conversions
193
-
-[dupl](https://github.com/mibk/dupl): Tool for code clone detection
194
-
-[goconst](https://github.com/jgautheron/goconst): Finds repeated strings that could be replaced by a constant
195
-
-[gocyclo](https://github.com/alecthomas/gocyclo): Computes and checks the cyclomatic complexity of functions
196
-
-[gofmt](https://golang.org/cmd/gofmt/): Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
197
-
-[goimports](https://godoc.org/golang.org/x/tools/cmd/goimports): Goimports does everything that gofmt does. Additionally it checks unused imports
198
-
-[maligned](https://github.com/mdempsky/maligned): Tool to detect Go structs that would take less memory if their fields were sorted
199
-
-[megacheck](https://github.com/dominikh/go-tools/tree/master/cmd/megacheck): 3 sub-linters in one: unused, gosimple and staticcheck
200
-
-[depguard](https://github.com/OpenPeeDeeP/depguard): Go linter that checks if package imports are in a list of acceptable packages
191
+
-[golint](https://github.com/golang/lint) - Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
192
+
-[interfacer](https://github.com/mvdan/interfacer) - Linter that suggests narrower interface types
193
+
-[unconvert](https://github.com/mdempsky/unconvert) - Remove unnecessary type conversions
194
+
-[dupl](https://github.com/mibk/dupl) - Tool for code clone detection
195
+
-[goconst](https://github.com/jgautheron/goconst) - Finds repeated strings that could be replaced by a constant
196
+
-[gocyclo](https://github.com/alecthomas/gocyclo) - Computes and checks the cyclomatic complexity of functions
197
+
-[gofmt](https://golang.org/cmd/gofmt/) - Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
198
+
-[goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) - Goimports does everything that gofmt does. Additionally it checks unused imports
199
+
-[maligned](https://github.com/mdempsky/maligned) - Tool to detect Go structs that would take less memory if their fields were sorted
200
+
-[megacheck](https://github.com/dominikh/go-tools/tree/master/cmd/megacheck) - 3 sub-linters in one: unused, gosimple and staticcheck
201
+
-[depguard](https://github.com/OpenPeeDeeP/depguard) - Go linter that checks if package imports are in a list of acceptable packages
201
202
202
203
# Configuration
203
204
## Command-Line Options
@@ -306,7 +307,6 @@ There is a [`.golangci.yml`](https://github.com/golangci/golangci-lint/blob/mast
306
307
It's a [.golangci.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.yml) of this repo: we enable more linters than by default and make their settings more strict:
307
308
```yaml
308
309
run:
309
-
deadline: 30s
310
310
tests: true
311
311
312
312
linters-settings:
@@ -410,26 +410,19 @@ Thanks to [alecthomas/gometalinter](https://github.com/alecthomas/gometalinter)
410
410
Thanks to [bradleyfalzon/revgrep](https://github.com/bradleyfalzon/revgrep) for cool diff tool.
0 commit comments