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
cmd/vet: Incorrect warning shown when code isn't built #15787
Comments
I'll look into this issue on this week |
Some vet tests do require that the packages be built, so that vet can do type checking. Some vet tests do not require this. As far as I know nothing in this regard has changed since 1.6. What has changed here is the test. The test looks for the function name and guesses based on the name what it does. It looks for a set of names. Since the 1.6 release, the following names were added: fprintln, panicln, println, sprintln. That's why 1.6 doesn't warn. It's not clear to me that this is worth fixing. The nature of the vet program is that some errors are false positives, especially if the code has not been built. You can disable the test for your code base with |
@ianlancetaylor , this may be easily fixed - see the CL. |
CL https://golang.org/cl/23351 mentions this issue. |
@ianlancetaylor I'm aware that I spent some time trying to reproduce it, as it only happens in a clean environment (where nothing has been built in the past), e.g. when using Travis CI. |
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
I ran
go vet
on the following program: https://play.golang.org/p/-AbGnFT_3WThe struct
foo
is intentionally undefined. The same problem occurs iffoo
is defined in another package, and that package hasn't been built yet.What did you expect to see?
No warnings reported by
go vet
(this is the case when using 1.6).What did you see instead?
It seems that building the code is required before running
go vet
now, is this an intentional change from 1.6?The text was updated successfully, but these errors were encountered: