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 -compiled -e fails completely if any package does not compile #26755

Open
matloob opened this issue Aug 1, 2018 · 7 comments
Assignees
Milestone

Comments

@matloob
Copy link
Contributor

@matloob matloob commented Aug 1, 2018

This is on tip. go version: go version devel +b8669ef1ce Wed Aug 1 14:29:58 2018 +0000 linux/amd64

go list -e should not fail if there are broken packages, or print errors to standard error, as per the documentation:

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).

go list -compiled -e breaks this.

Repro:

matloob@matloob:~$ mkdir /tmp/empty
matloob@matloob:~$ cd /tmp/empty
matloob@matloob:/tmp/empty$ devgo version
go version devel +b8669ef1ce Wed Aug 1 14:29:58 2018 +0000 linux/amd64
matloob@matloob:/tmp/empty$ devgo list -e -compiled >/dev/null
go build _/tmp/empty: no Go files in /tmp/empty
matloob@matloob:/tmp/empty$ echo $?
1
@matloob

This comment has been minimized.

Copy link
Contributor Author

@matloob matloob commented Aug 1, 2018

@myitcv

This comment has been minimized.

Copy link
Member

@myitcv myitcv commented Aug 2, 2018

Dup of #25842?

@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Aug 3, 2018
@bcmills bcmills added the GoCommand label Nov 14, 2018
@bcmills bcmills self-assigned this Nov 14, 2018
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Nov 14, 2018

Probably a duplicate, but it wouldn't hurt to test -export and -compiled separately.

@bcmills bcmills modified the milestones: Go1.12, Go1.13 Dec 12, 2018
@bcmills bcmills changed the title cmd/go: go list -compiled -e fails returns fails for broken packages cmd/go: go list -compiled -e fails for broken packages Jan 18, 2019
@bcmills bcmills changed the title cmd/go: go list -compiled -e fails for broken packages cmd/go: go list -compiled -e fails completely if any package does not compile Jan 18, 2019
@matloob

This comment has been minimized.

Copy link
Contributor Author

@matloob matloob commented May 24, 2019

Do we think this'll get fixed for 1.13?

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented May 28, 2019

Not sure. Only if the fix is simple, but I suspect it will not be.

@nabice

This comment has been minimized.

Copy link

@nabice nabice commented Jul 2, 2019

I think stdout should be returned, even though go list -e returns a non-zero exit.
It will be helpful to collect more information for go/analysis.
https://github.com/golang/tools/blob/38ae2c8f64122bd595b7f93f968a6686cd27bb5a/go/packages/golist.go#L802-L816

@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Oct 22, 2019

This is what I get on tip (+57ad6ef15d Tue Oct 22 04:05:25 2019 +0000 linux/amd64) now

12:29:25-agniva-/tmp/empty$gotip list -e -compiled > /dev/null 
12:29:33-agniva-/tmp/empty$echo $?
0

@bcmills ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.