Fix#324, relates #314
1. Update gocritic to the latest version
2. Use proper gocritic checkers repo, old repo was archived
3. Get enabled by default gocritic checks in sync with go-critic: don't
enable performance, experimental and opinionated checks by default
4. Support of `enabled-tags` options for gocritic
5. Enable almost all gocritic checks for the project
6. Make rich debugging for gocritic
7. Meticulously validate gocritic checks config
Also do following improvements:
- show proper sublinter name for megacheck sublinters
- refactor and make more simple and robust megacheck
merging/optimizing
- improve handling of unknown linter names in //nolint directives
- minimize diff of our megacheck version from the upstream,
https://github.com/golang/go/issues/29612 blocks usage of the upstream
version
- support the new `stylecheck` linter
- improve tests coverage for megacheck and nolint related cases
- update and use upstream versions of unparam and interfacer instead of forked
ones
- don't use golangci/tools repo anymore
- fix newly found issues after updating linters
Also should be noted that megacheck works much faster and consumes less
memory in the newest release, therefore golangci-lint works noticeably
faster and consumes less memory for large repos.
Relates: #314
The new version of goimports works 100x faster
with go modules. Also it has some new features:
$ git cherry -v 6c7e314b6563 92cdcd90bf52 | fgrep imports
+ 5bbcdc15656ef390fab5dd6e8daf95354f7171e3 imports: redesign fixImports
+ ee45598d2ff288037f53f9e13ae0b1a6e2165ad5 imports: create named imports for name/path mismatches (again)
+ 4c53570e0460bc32468f75bf9dd71c018d03bfa9 imports: ignore globals in different packages
+ 1d424dbce8dd500e9e449fd3ff9d0668c09e2ae1 imports: clean up customization seam
+ 6a3e9aa2ab7749d72d1006ee484271b4a11f96c2 imports: fix renamed sibling imports
+ 5f4a60f04f23ac48e0665f257413ae3eacf339be imports: fix renamed sibling imports more
+ bbccd8cae4a9a47e0f978e03ff4b5df88a9fde1e imports: use go/packages, support modules
+ d4971274fe382404aee0e8c163af974f2bf738e6 imports: don't remove imports that conflict with globals
People these days tend to use default GOPATH, so environment variable will be empty.
go env GOPATH will work for all cases
Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
Prior to this change the SkipDir runner was not skipping files such as
`foo/bar/baz.go` with a `skip-dir` entry of `foo/bar` when the `run`
command was invoked with an argument of `foo/...`. This is both a
surprising and problematic behavior change.
The pathology was:
1. `shouldPassIssue()` was receiving an input like `foo/bar/baz.go`
2. `shouldPassIssue()` would call `p.getLongestArgRelativeIssuePath()`
which was returning `bar`, not `foo/bar` as expected.
3. The reason for this was because inside of
`getLongestArgRelativeIssuePath()` it was trimming the prefix that
matched the path prefix (e.g. `foo/`).
If you have the file structure:
- foo/bar/baz.go
- bur/bar/baz.go
There is no way to isolate `foo/bar` from `bur/baz` without strictly
controlling both your `skip-dirs` configuration and the arguments to
`run`.
The rest of the logic to skip files that don't match `run`'s argument
is valid, however the regexp should be evaluated based on the
`filepath.Dir()` of the input (e.g. `foo/bar`) and not the truncated
version of the issue's filepath.
Fixes: #301
This change introduces the ability to use the tilde (`~`) character in your
`-c/--config` flag value to expand your home directory. If invoking this via the
command line with `--config ~/.golangci-lint.yaml`, the user's shell expands the
`~` to the home directory. However, if something is invoking the program for
you (like an editor) it may not do the expansion.
Fixes#289
Signed-off-by: Tim Heckman <t@heckman.io>