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

Closed
matloob opened this issue Aug 1, 2018 · 9 comments
Closed
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@matloob
Copy link
Contributor

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
Copy link
Contributor Author

matloob commented Aug 1, 2018

cc @bcmills @rsc @suzmue @ianthehat

@myitcv
Copy link
Member

myitcv commented Aug 2, 2018

Dup of #25842?

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 3, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Aug 3, 2018
@bcmills bcmills added the GoCommand cmd/go label Nov 14, 2018
@bcmills bcmills self-assigned this Nov 14, 2018
@bcmills
Copy link
Contributor

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
Copy link
Contributor Author

matloob commented May 24, 2019

Do we think this'll get fixed for 1.13?

@bcmills
Copy link
Contributor

bcmills commented May 28, 2019

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

@nabice
Copy link

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
Copy link
Contributor

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 ?

@bcmills
Copy link
Contributor

bcmills commented Dec 20, 2019

The original reproducer does seem to be fixed in 1.14.

$ mkdir empty

$ cd empty

empty$ go1.14beta1 list -e -compiled
_/tmp/tmp.xl7JwKGEfx/empty

empty$ GO111MODULE=on go1.14beta1 list -e -compiled
go: cannot find main module; see 'go help modules'

empty$ GO111MODULE=on go1.14beta1 mod init empty
go: creating new go.mod: module empty

empty$ GO111MODULE=on go1.14beta1 list -e -compiled
_/tmp/tmp.xl7JwKGEfx/empty

empty$

@matloob, do you have any other reproducers for this?

@bcmills bcmills removed their assignment Dec 20, 2019
@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 20, 2019
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Jan 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

9 participants