Golang 1.15 comes to few improvements, one of them is to have smaller
binary.
This PR is to make golang 1.15 as default version in CI, I also update
Docker based image to golang:1.15* as well.
Two issues faced with golang 1.15:
- Conflict between -v in `golangci-lint` and `go test`. Update to --verbose
to avoid the same. [1]
- `nolintlint_unused.go` testdata is not matching regex. Correct by adding one
space after //
[1]: https://github.com/golang/go/issues/40763
Signed-off-by: Tam Mach <sayboras@yahoo.com>
* Introduce gci as new linter
Signed-off-by: Xiang Dai <long0dai@foxmail.com>
* use goimports setting if not specified
Signed-off-by: Xiang Dai <long0dai@foxmail.com>
* wip
more
add new files
run command fixes
more
* go.mod
* order
* same package
* review comment
* enable linter in .golangci.yml
* add testcase for default-signifies-exhaustive: true
* adjust runGoErrchk instead
* disable the linter
* cleanup
* more cleanup
* cleanup
Run CI on mac os only with go1.13 and on windows only on go1.14.
Speed up tests. Introduce --allow-parallel-runners.
Block on parallel run lock 5s instead of 60s.
Don't invalidate analysis cache for minor config changes.
If the target files contains `//line` directive and it indicates
a non-go file, the linter is going to handle it as a go file,
which results in failure.
The cause of this issue is that the linters (`Analyzer`s) are using
`pass.Fset.Position()`. This func returns the adjusted position using
`//line` directive.
The example project reported in #998 has `//line` directive that
indicates other non-go file.
According to the description of "Compiler Directives”
(https://golang.org/cmd/compile/#hdr-Compiler_Directives),
line directives is mainly used for reporting original positions to
the generators or something.
On linters of golangci-lint, `pass.Fset.Position()` is used just to
aggregate file names; we don't have to adjust positions.
This changes `Analyzer`s that use `pass.Fset.Position()` to aggregate
file names to use `pass.Fset.PositionFor()` with `adjusted == false`.
Relates: #998
full diff: https://github.com/dominikh/go-tools/compare/2019.2.3...2020.1.3
Also updates tests to accomodate updated rules:
--- FAIL: TestSourcesFromTestdataWithIssuesDir/staticcheck.go (0.43s)
linters_test.go:137: [run --disable-all --print-issued-lines=false --print-linter-name=false --out-format=line-number --max-same-issues=10 -Estaticcheck --no-config testdata/staticcheck.go]
linters_test.go:33:
Error Trace: linters_test.go:33
linters_test.go:138
linters_test.go:53
Error: Received unexpected error:
staticcheck.go:11: no match for `self-assignment of x to x` vs ["SA4006: this value of `x` is never used"] in:
staticcheck.go:11:2: SA4006: this value of `x` is never used
unmatched errors
staticcheck.go:11:2: SA4006: this value of `x` is never used
Test: TestSourcesFromTestdataWithIssuesDir/staticcheck.go
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* test that demostrates that deadline is not working if comes from the config
* overriding timeout with deadline when only deadline is different from its default value
* tests were not passing. default value for Deadline, that now only comes from config, is 0. Plus static check is going to fail because of deprecated cfg used
* golangci should use the latest golangci-lint version, that is the one deprecating deadline in favour of timeout
* README updated - looks the ci config in this project is used to generate usage instructions.. great!