Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/vet: decide how to handle type checking failure #21287
This issue is to decide how cmd/vet should handle type checking failures.
In https://golang.org/cl/7393052 (pre-1.1) type checking was added to cmd/vet. A type checking error would issue a warning and cause vet to exit with status 1.
Issue #4895 complained about this behavior, because it meant that the type checker had to be able to find imported packages. In that issue Russ said "It would definitely be nice for 'go vet' to be able to run in degraded mode. I ran it on a large uncompiled tree over the weekend and was pretty annoyed by all the import messages."
https://golang.org/cl/7399051 (also pre-1.1) addressed this problem by only issuing the warning, and setting the exit status, if vet were run with the
People rarely ran vet with the
https://golang.org/cl/40112 (pre-1.9) changed cmd/go to pass more flags to vet. In particular, after that change,
This led to issue #21188 complaining that
https://golang.org/cl/52851 (also pre-1.9) changed cmd/vet so that a type checking error just prints a message with
How do we want to handle this going forward?
Thanks for the thorough explanation of the history of the issue, Ian.
Something to add is #6774 - eventually, the
I strongly believe this is a bad idea, because it's counter-intuitive. It's also worth noting that since
referenced this issue
Aug 3, 2017
https://go-review.googlesource.com/c/go/+/74356 is for #18084 but the idea was to also hook it up to #16086, so that when run as "go vet", vet can expect that it will have complete type information and no magic import "C" to worry about. Then it should be a fatal error in that mode for vet to fail to typecheck.
So the decision here is "go vet" will be fixed so that it can always typecheck, and then failure to typecheck will be a fatal error. Given that decision, this is a duplicate of #16086.