-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: document exit codes of a process executing go test
#25989
Comments
Ignore me I'm an idiot. t.Error != t.Fail I agree with the OP however, it should have a none 0 status, 1 for error, 2 for fail maybe? |
Right now the exit status is 1 for most failures, 2 if the build was interrupted. |
Do we distinguish between flag parsing errors where different exit codes are output? For example, passing in "-c=invalid" returns a 2
while passing in "-covermode=invalid" returns a 1.
|
@GTB3NW note that your particular problem is most possibly not related to the essense of this issue which is about documenting the implemented behaviour which appears to be OK. I've created this issue merely because such things ought to be documented for reference purposes (say, for DevOps folks which may be not too familiar with Go to implement the CI pipeline). Try to figure out what may mask the exit code of your
this code won't ever exit if
Updated @GTB3NW, ah, I see you got sorted it out :-) |
Okay here's one for you then, I've read the documentation, perhaps I'm missing something here, but the following should FAIL and return error code 1 should it not?
Should that not be a FAIL on /blahtest too? The aim is to just run:
Test all the packages and if any one of them fails the whole test fails, surely that's a common requirement. Either I'm misunderstanding the testing facilities/there's a bug/go test is lacking something critical. Could anyone set me in the right direction please I'd really appreciate it :) |
@GTB3NW, if you're seeing a 0 exit code or |
Before we document the error codes, I think we will probably need to do some work to make them consistent. That's a pretty big investigation, and probably ought to happen as part of a broader |
Change https://go.dev/cl/660076 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.10.3
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?What did you do?
I run
go help test
and try to search for keywords "return", "exit", "code" in the output.What did you expect to see?
I expect the possible exit codes for running
go test
be documentedin order to make sensible decisions about running this command in scripts
(and from Makefiles, by a CI system etc).
What did you see instead?
No menton of the return/exit code.
I'd expect the following cases to be documented if implemented:
different from that of the former case.
I'd also think that the cached results should effectively "memorize" the exit codeused ATM the results were generated (and cached).
See also #23716.
The text was updated successfully, but these errors were encountered: