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
1. Allow govet to work in 2 modes: fast and slow. Default is slow.
In fast mode golangci-lint runs `go install -i` and `go test -i`
for analyzed packages. But it's fast only when:
- go >= 1.10
- it's repeated run or $GOPATH/pkg or `go env GOCACHE` is cached
between CI builds
In slow mode we load program from source code like for another linters
and do it only once for all linters.
3. Patch govet code to warn about any troubles with the type
information. Default behaviour of govet was to hide such warnings.
Fail analysis if there are any troubles with type loading: it will
prevent false-positives and false-negatives from govet.
4. Describe almost all options in .golangci.example.yml and
include it into README. Describe when to use slow or fast mode of govet.
5. Speed up govet: reuse AST parsing: it's already parsed once by
golangci-lint.
For "slow" runs (when we run at least one slow linter) speedup by
not loading type information second time.
6. Improve logging, debug logging
7. Fix crash in logging of AST cache warnings (#118)
Copy file name to clipboardExpand all lines: README.md
+158-7
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ GolangCI-Lint can be used with zero configuration. By default the following lint
84
84
```
85
85
$ golangci-lint linters
86
86
Enabled by default linters:
87
-
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]
87
+
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]
88
88
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]
89
89
staticcheck: Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false]
90
90
unused: Checks Go code for unused constants, variables, functions and types [fast: false]
@@ -311,10 +311,161 @@ To see which config file is being used and where it was sourced from run golangc
311
311
Config options inside the file are identical to command-line options.
312
312
You can configure specific linters' options only within the config file (not the command-line).
313
313
314
-
There is a [`.golangci.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) example config file with all supported options.
314
+
There is a [`.golangci.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) example
315
+
config file with all supported options, their description and default value:
316
+
```yaml
317
+
# This file contains all available configuration options
318
+
# with their default values.
319
+
320
+
# options for analysis running
321
+
run:
322
+
# default concurrency is a available CPU number
323
+
concurrency: 4
324
+
325
+
# timeout for analysis, e.g. 30s, 5m, default is 1m
326
+
deadline: 1m
327
+
328
+
# exit code when at least one issue was found, default is 1
329
+
issues-exit-code: 1
330
+
331
+
# include test files or not, default is true
332
+
tests: true
333
+
334
+
# list of build tags, all linters use it. Default is empty list.
335
+
build-tags:
336
+
- mytag
337
+
338
+
# which dirs to skip: they won't be analyzed;
339
+
# can use regexp here: generated.*, regexp is applied on full path;
340
+
# default value is empty list, but next dirs are always skipped independently
Copy file name to clipboardExpand all lines: README.md.tmpl
+10-6
Original file line number
Diff line number
Diff line change
@@ -200,10 +200,14 @@ To see which config file is being used and where it was sourced from run golangc
200
200
Config options inside the file are identical to command-line options.
201
201
You can configure specific linters' options only within the config file (not the command-line).
202
202
203
-
There is a [`.golangci.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) example config file with all supported options.
203
+
There is a [`.golangci.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) example
204
+
config file with all supported options, their description and default value:
205
+
```yaml
206
+
{{.GolangciYamlExample}}
207
+
```
204
208
205
209
It's a [.golangci.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.yml) config file of this repo: we enable more linters
206
-
than the default and more strict settings:
210
+
than the default and have more strict settings:
207
211
```yaml
208
212
{{.GolangciYaml}}
209
213
```
@@ -275,11 +279,11 @@ go install ./vendor/github.com/golangci/golangci-lint/cmd/golangci-lint/
275
279
```
276
280
Vendoring `golangci-lint` saves a network request, potentially making your CI system a little more reliable.
277
281
278
-
**`govet` or `golint` reports false-positives or false-negatives**
282
+
**Does I need to run `go install`?**
279
283
280
-
These linters obtain type information from installed package files.
281
-
The same issue you will encounter if will run `govet` or `golint` without `golangci-lint`.
282
-
Try `go install ./...` (or `go install ./cmd/...`: depends on the project) first.
284
+
No, you don't need to do it anymore. We will run `go install -i` and `go test -i`
285
+
for analyzed packages ourselves. We will run them only
286
+
if option `govet.use-installed-packages` is `true`.
0 commit comments