-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
govet can produce false-positive without running go install first #17
Comments
Thank you for report!
and attach the output |
Output for
For the second command, I am not sure what is
|
@shuLhan thank you, it's an interesting case. The most interesting part is:
Does this program compile? |
Yes.
When using
Seems like go vet did not check input format if it's not constant. |
send a full output of next commands, please: pwd
echo $GOPATH $GOROOT
cat govet.go
go tool vet -v govet.go
go vet -v .
go run govet.go
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
golangci-lint run -v -E typecheck govet.go |
In previous comment I renamed the folder from Here is the output of all commands,
I use golangci-lint version 1.3.2 for above command. For golangci-lint v1.3.4,
|
I think the
Recompiling golangci-lint v1.3.4 with Go master, and running it again,
I think we can conclude that this is issue in Go. Should I close this? |
This time I test it in clean GOPATH, no other packages except golangci-lint and test file. I am afraid this is something about cache. Using Go v1.10.2 and golangci-lint v1.3.5.
Are you sure this is not bug in |
|
@shuLhan try please branch |
Ok, that branch fixed it.
|
@shuLhan thank you very much! The problem is in default import mechanism of |
@golangci No, thank you, for this open source project. |
I have an idea as a fast fix for you: try |
I suppose it's the same as #87 (comment) |
1. Allow govet to work in 2 modes: fast and slow. Default is slow. In fast mode golangci-lint runs `go install -i` and `go test -i` for analyzed packages. But it's fast only when: - go >= 1.10 - it's repeated run or $GOPATH/pkg or `go env GOCACHE` is cached between CI builds In slow mode we load program from source code like for another linters and do it only once for all linters. 3. Patch govet code to warn about any troubles with the type information. Default behaviour of govet was to hide such warnings. Fail analysis if there are any troubles with type loading: it will prevent false-positives and false-negatives from govet. 4. Describe almost all options in .golangci.example.yml and include it into README. Describe when to use slow or fast mode of govet. 5. Speed up govet: reuse AST parsing: it's already parsed once by golangci-lint. For "slow" runs (when we run at least one slow linter) speedup by not loading type information second time. 6. Improve logging, debug logging
1. Allow govet to work in 2 modes: fast and slow. Default is slow. In fast mode golangci-lint runs `go install -i` and `go test -i` for analyzed packages. But it's fast only when: - go >= 1.10 - it's repeated run or $GOPATH/pkg or `go env GOCACHE` is cached between CI builds In slow mode we load program from source code like for another linters and do it only once for all linters. 3. Patch govet code to warn about any troubles with the type information. Default behaviour of govet was to hide such warnings. Fail analysis if there are any troubles with type loading: it will prevent false-positives and false-negatives from govet. 4. Describe almost all options in .golangci.example.yml and include it into README. Describe when to use slow or fast mode of govet. 5. Speed up govet: reuse AST parsing: it's already parsed once by golangci-lint. For "slow" runs (when we run at least one slow linter) speedup by not loading type information second time. 6. Improve logging, debug logging 7. Fix crash in logging of AST cache warnings (#118)
Environment
Reproduction Steps
golangci-lint run
Expected Result
Congrats! No issues were found.
Actual Result
The text was updated successfully, but these errors were encountered: