-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/vet: check files not in current build context #29901
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
Comments
It's generally correct for cmd/vet to ignore files with a You should be able to run vet on that file via |
Why is that considered correct? vet isn't building those files, its vetting them and that should happen to all files regardless of whether or not they are in the current build. Vet reports the package's correctness, which should include reporting on files that will not be built on the current platform. |
vet type checks the package, which can't be done if it reads files with ignored build tags. The type checking enables much more powerful checks. I'm not saying that it's not useful to look at all files, just that vet is not the tool for that. |
Agreed, when vet is asked to vet a package, it should look only at the files that make up that package. This is even more necessary now that vet gets complete type information. If you want vet to look at a different set of files, you can pass the list to it just like you can do to |
Lets say this file was in a package (it's used to go generate a revision file):
go vet
ing the package would not also vet this file. You can confirm by passing the file in explicitly afterwards and seeing vet complain about line 19.The text was updated successfully, but these errors were encountered: