Closed jaqx0r closed 5 years ago
I have the same issue, I think it's related to https://github.com/golangci/golangci-lint/commit/96af9582052f62722593d4085f2357df508a6310
In my case, the source is on a symlink:
# GOPATH=/home/workspace/
/home/workspace/src/github.com/foo/bar -> /home/runner/bar/
I'm also having this issue. However, when I delete the line directive above the package declaration in my auto-generated file, I no longer get the error. My guess is that when the auto-generated file contains this line, golangci-lint puts an entry in the AST cache for the source file rather than the generated file.
FYI this issue may be fixed by https://github.com/golangci/golangci-lint/pull/417 which updates the AST cache to always use the normalized file path for all loads/stores.
hi! yes, it was fixed in #417
Resolving as #417 was merged some time ago.
In the text below and also per the golangci link below, the file
internal/vm/parser/parser.go
is not in the cache because, I think, it's being excluded due to having the word "autogenerated" in the source text.This is confusing the golint, goconst, and a few other linters -- several show up as not being able to find 'parser.go' in the map.
If I remove the "skip-files" section from golintci.yml, then the errors don't go away. Commit https://github.com/google/mtail/commit/de0e167e25c5f30e33d479c65d0bcd9a9953d7e3 removes it, and you can see the result is the same.
Please include the following information:
golangci-lint --version
(or git commit if you don't use binary distribution)golangci-lint has version 1.15.0 built from 901cf25 on 2019-02-18T08:24:43Z
cat .golangci.yml
https://github.com/google/mtail/blob/master/.golangci.yml
go version && go env
golangci-lint run -v
Example output is at https://golangci.com/r/github.com/google/mtail
Here's a snippet: