-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go build -n prints to both stderr and stdout #12913
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
Comments
go build -n
prints to both stderr and stdout
I think the correct thing is to print them all to stdout. |
The current behavior is intentional. The pragma comments are additional bits to inform humans. Shouldn't the machines always consume the stderr? |
Stderr was invented to convey messages to humans, not machines. The machine-readable output should be sent to stdout so that it can be easily piped into another program or file. In this case, if I'm running |
Sorry, s/stderr/stdout. The use of two different streams is intentional and you can always 2>&1. I don't think there is anything wrong with the current behavior. |
The commands are printed to stderr. I think they should be printed to stdout. The pragmas can also be printed to stdout as they are just shell comments. |
gomobile prints commands and comments both to stderr. Regardless of what the final decision, at least, we need to be consistent and apply the same convention to gomobile. (FWIW, the only justification to write to stderr might be able to diff between |
I'm not sure if we have made a policy decision about stdout/stderr, but if On 13 October 2015 at 16:38, rakyll notifications@github.com wrote:
|
I don't really have a strong opinion on whether the Can @rsc advise? |
It is in no way intentional that the output is split between stdout and stderr. Originally it was all to stdout. CL 7393073 moved the bulk of the output to stderr. The # block print was missed. The fix is to change
to use b.print like everything else. Thanks. |
CL https://golang.org/cl/16737 mentions this issue. |
go version go1.5 darwin/amd64
go build -n
prints the commands that would be executed to stderr, but it prints comments showing package names to stdout.So for example, stderr looks like:
whereas stdout looks like
This makes it difficult to match up the helpful package name comments with the commands to which they pertain. I was expecting that either both would be printed to stderr or both would be printed to stdout.
The text was updated successfully, but these errors were encountered: