stop go run from printing "exit status 1"?

1,874 views
Skip to first unread message

Nate Finch

unread,
Nov 4, 2016, 10:49:17 PM11/4/16
to golang-nuts
If the script you run with go run returns a non-zero exit status, go run prints "exit status N" and itself then returns with exit code 1.

Now, this seems like a double mistake - first off, the only time go run should print anything out is if it had some problem actually running the code, i.e. unable to find the file, unable to compile, etc.  After that, it should just directly mirror whatever the running code writes to stdout and stderr, no more no less.  This also means that if the script returns exit code 13, go run should return with exit code 13.  Right now it only ever returns 0 for success and 1 for an error.

Is this something that can be changed?  Not sure how backwards compatibility is handled in these situations.

adon...@google.com

unread,
Nov 5, 2016, 8:05:00 PM11/5/16
to golang-nuts
It does seem a little bit arbitrary and contrary to UNIX tool design principles.  It's unlikely that this is a compatibility concern for anyone.  File a bug if you feel strongly about it.

Nate Finch

unread,
Nov 5, 2016, 10:12:04 PM11/5/16
to golang-nuts, adon...@google.com
Reply all
Reply to author
Forward
0 new messages