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: go list -e -export -json -gcflags=-bogus math prints to stderr #46817

Open
mdempsky opened this issue Jun 18, 2021 · 1 comment
Open

cmd/go: go list -e -export -json -gcflags=-bogus math prints to stderr #46817

mdempsky opened this issue Jun 18, 2021 · 1 comment
Labels
Milestone

Comments

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Jun 18, 2021

https://tip.golang.org/cmd/go/#hdr-List_packages_or_modules says:

The -e flag changes the handling of erroneous packages, those that cannot be found or are malformed. By default, the list command prints an error to standard error for each erroneous package and omits the packages from consideration during the usual printing. With the -e flag, the list command never prints errors to standard error and instead processes the erroneous packages with the usual printing. Erroneous packages will have a non-empty ImportPath and a non-nil Error field; other information may or may not be missing (zeroed).

However, at least some compiler errors still end up getting written to stderr. For example, go list -e -export -json -gcflags=-bogus math >/dev/null shows output for me.

/cc @rsc @bcmills @jayconrod

@bcmills bcmills added this to the Backlog milestone Jun 18, 2021
@wymli
Copy link

@wymli wymli commented Jul 22, 2021

go get prints to stderr too.
It's kind of strange.
For example, I have to use update_msg=$(go get -u ${some_pkg} 2>&1) to capture the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants