Skip to content
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 'go run' exit codes #23716

Closed
stub42 opened this issue Feb 6, 2018 · 3 comments
Closed

cmd/go: document 'go run' exit codes #23716

stub42 opened this issue Feb 6, 2018 · 3 comments

Comments

@stub42
Copy link

stub42 commented Feb 6, 2018

What version of Go are you using (go version)?

go version go1.9.3 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

go run --help
Viewing https://golang.org/cmd/go/#hdr-Compile_and_run_Go_program

What did you expect to see?

Documentation on how to use 'go run' and what it is for. In particular, per #13440 what the return code is expected to be. 'go run' returns the build stage return code and not the return code of the actual code being run, which is not what is expected by many (most?) users.

What did you see instead?

No mention of the design choice, leading us to suspect a bug. This would seem to be the common assumption for 'go run', as the 'go' tool provides multiple ways to get build success but no mechanism to execute built code and report that success, so deserves to be documented to avoid surprising developers.

Clarification of the use cases for the current design of 'go run' may be helpful, where it is beneficial to get the build stage return code in favour of the executed codes return code. Again, our use cases led us to suspect this was a bug rather than a feature.

@odeke-em odeke-em changed the title Document 'go run' exit code cmd/go: document 'go run' exit codes Feb 6, 2018
@odeke-em
Copy link
Member

odeke-em commented Feb 6, 2018

/cc @rsc @ianlancetaylor @bradfitz

@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Feb 6, 2018
@gopherbot
Copy link

Change https://golang.org/cl/94795 mentions this issue: cmd/go: document 'go run' exit codes

@ysmolski
Copy link
Member

I have added some documentation but not sure if that's enough. Also I am not sure if I should have mentioned that the exit code from go run is always 1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants