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/go: unexpected exit codes for go tool ... #17145
Comments
It's correct as is. It exits with code 2 if the arguments are incorrect, that is, if Usage is called. |
|
The go tool subcommand mishandles error codes. It's not disastrous but the codes are odd.
That one is due to an explicit setExitCode(3); it should be 2.
One would expect the go tool vet command to exit with the same code as go vet. Also, as one expects, the vet binary run without the go tool exits with 2 in this case. |
This error, the second one above,
is not cleanly addressable because os.ProcessState does not tell you the failing exit code portably; in fact, the exit code is simply unix-specific. Might as well leave it alone; at least it's non-zero indicating command failure. |
CL https://golang.org/cl/31253 mentions this issue. |
If we leave it alone, I think that the related description in https://golang.org/cmd/vet/ should be updated. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?https://golang.org/cmd/vet/ says:
The vet exit code is set by setExit function. A check of the source code in
src/cmd/vet
shows that there is no invocation likesetExit(2)
. Should the doc be updated to reflect the code logic?The text was updated successfully, but these errors were encountered: