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>
1. Fix crash if deps of analyzed packages weren't compiled.
2. Print deps typechecking errors
3. Fix all issues filtering because of empty go env GOCACHE for go < 1.10
Use go/packages instead of x/tools/loader: it allows to work
with go modules and speedups loading of packages with the help
of build cache.
A lot of linters became "fast": they are enabled by --fast now and
work in 1-2 seconds. Only unparam, interfacer and megacheck
are "slow" linters now.
Average project is analyzed 20-40% faster than before if all linters are
enabled! If we enable all linters except unparam, interfacer and
megacheck analysis is 10-20x faster!
Motivation: Make it clear that the message is indicating packages
*which do not compile*, rather than packages which *won't be
compiled [for some unknown reason]*.