Description
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 -v
option.
People rarely ran vet with the -v
option, because there was no way to do so when using go vet
; it could only be done by using go tool vet
.
https://golang.org/cl/40112 (pre-1.9) changed cmd/go to pass more flags to vet. In particular, after that change, go vet -v
invoked cmd/vet with the -v
option.
This led to issue #21188 complaining that go vet -v
now caused unexpected errors when a package was not available (for example, the special "C" package used by cgo). This was essentially a repeat of #4895, only with the -v
option that is now easier to use.
https://golang.org/cl/52851 (also pre-1.9) changed cmd/vet so that a type checking error just prints a message with -v
, rather than issuing a warning and thus changing the exit status to 1.
How do we want to handle this going forward?
- Should a type checker error cause vet to exit with status 1?
- Should vet change its exit status depending on whether -v is used?
- Does it matter if the type checker error is specifically a missing import?
- Does it matter if the missing import is "C"?
CC @robpike