-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/vet: could not import C error when used with -v #21188
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
To clarify - |
What I've found so far - the reason that
Should And it seems like the underlying cause is I still see the change in behavior as a regression, though. An error that was being ignored is now being surfaced by Edit: I did not intend to mark this issue as a duplicate. |
Maybe warnf shouldn't cause vet to return 1. |
It certainly seems that way, given the name. That fix would be ok for 1.9, as far as I'm concerned. |
Here's where I pass the buck. :)
This decision belongs to @robpike.
That call is above my pay grade. @bradfitz or @ianlancetaylor? |
I can't speak to the underlying issue in the importer. That should be fixed. But I do believe that the exit code should be 1. The purpose of warnf is to report an error but not exit the program, as further tests are possible. It indicates a problem, in this case that it can't import one of the packages, and so vet cannot say that there are no errors in the program. In short, warnf should cause an exit with code 1. Vet should exit with 0 only when the whole program has been checked successfully and without problems. |
Oh, above mine too - I was simply giving my opinion :)
My point here was not so much whether an import error should make the program fail, or whether a warning should make it fail. It was more the fact that |
Doesn't that imply that |
The vet tool runs the type checker in go/types. The warning being reported is a type checking failure. We only report that warning when using -v, because vet is supposed to work on packages that do not type check. So as @bcmills suggests I think that this output is best characterized as not being a warning. I will send a CL. |
Change https://golang.org/cl/52851 mentions this issue: |
The vet tool only reports a type checking error when invoked with -v. Don't let that by itself cause vet to exit with an error exit status. Updates #21188 Change-Id: I172c13d46c35d49e229e96e833683d8c82a77de7 Reviewed-on: https://go-review.googlesource.com/52851 Reviewed-by: Josh Bleecher Snyder <[email protected]> Reviewed-by: Rob Pike <[email protected]>
Fixed for 1.9, opened #21287 for 1.10. |
What version of Go are you using (
go version
)?go version devel +45a4609c0a Thu Jul 27 05:04:28 2017 +0000 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
Success, even with
-v
.What did you see instead?
The unexpected import error.
go vet -v
doesn't have this issue on 1.8.3, so I'm marking as a release blocker for 1.9.Something to note is that the catalyst for this bug was the fix for #19350 by @robpike. In 1.8, when running
go vet -v
, the verbose flag wasn't passed togo tool vet
, and the bug was hidden away.But if we run the tool manually in both 1.8.3 and master, it's broken on both:
The obvious, faster option is to revert 62aeb77. Given that we have a bit of time left until 1.9 is supposed to go out, I'll poke around
go tool vet
to see if I can fix the bug there.The text was updated successfully, but these errors were encountered: