* Update WSL to v1.2.4
* Fix false positive multiline case
* Fix false positive slice expression
* Fix false positive index expression
* Support to configure/allow cuddle declarations
* Support to configurre/allow case blocks to end with whitespace
* Support cuddle defer http body close
* Re-generate README.md
* Update WSL to v1.2.5
* Support output comments for example functions
* Fix bad field tag for config
* Add WSL linter
* Use v1.0.0 tag for wsl
* Don't add specific test file skip, use mutex to add errors
* Fix goimports error
* Add more tests for WSL, bump WSL version
* Fix bad go.sum (go mod tidy)
* Add gocognit linter
* Remove gocognit to the golangci config
* Make changes on README.md
* Remove gocognit from megacheck benchtest
* Remove command line flags
* Comply with new style
Run all linters per package. It allows unloading package data when it's
processed. It dramatically reduces memory (and CPU because of GC) usage.
Relates: #337
Some analyzers are not intended for direct usage and are
just build blocks for other analyzers.
Seems like we can distinguish them by ResultType nillness.
Set analysis pass results to nil early to garbage collect them
soon.
Memory can be reduced for the following linters:
- staticcheck
- stylecheck
- gosimple
- govet
- bodyclose
- any future go/analysis linter
Relates: #712, #634, #628, #598, #509, #483, #337
* update staticcheck
Don't fork staticcheck: use the upstream version.
Remove unneeded SSA loading.
* Cache go/analysis facts
Don't load unneeded packages for go/analysis.
Repeated run of go/analysis linters now 10x faster
(2s vs 20s on this repo) than before.
Don't perform extra go env calls in go/packages.
Load only needed go env vars in golangci-lint.
Stay in sync by enabled analyzers in go vet: remove nilness and
atomicalign analyzers, add errorsas analyzer.
Don't build SSA for govet.
Standalone govet runs 25% faster than before. All runs can be 5-10% faster
than before.
Relates: #208
This false-positive is not present in the upstream stand-alone 'unused'
2019.1.1 program that golangci-lint uses.
pkg/lint.ContextLoader.filterPackages() did two things:
1. It removed synthetic "testmain" packages (packages with .Name=="main"
and .PkgPath ending with ".test")
2. It removed pruned subsumed copies of packages; if a package with files
"a.go" and "a_test.go", it results in packages.Load giving us two
packages:
- ID=".../a" GoFiles=[a.go]
- ID=".../a [.../a.test]" GoFiles=[a.go a_test.go]
The first package is subsumed in the second, and leaving it around
results in duplicated work, and confuses the 'deadcode' linter.
However, the 'unused' linter relies on both the ".../a" and
".../a [.../a.test]" packages being present. Pruning them causes it to
panic in some situations, which lead to this workaround:
af6baa5dc1
While that workaround got it to not panic, it causes incorrect results.
So, split filterPackages() in to two functions: filterTestMainPackages()
and filterDuplicatePackages(). The linter.Context.Packages list only
gets filterTestMainPackages() called on it, while linter.Context.Program
and linter.Context.SSAProgram get both filters applied.
With the source of the panic fixed, roll back a few now-unnecessary
commits in go-tools.
Significantly improve CPU and memory usage when not using SSA-powered linters.
Improve readability of go/packages errors.
Improve debugging capabilities and write doc about debugging.