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: list -compiled -find ignores cgo caching #29371

Closed
heschi opened this issue Dec 21, 2018 · 2 comments
Closed

cmd/go: list -compiled -find ignores cgo caching #29371

heschi opened this issue Dec 21, 2018 · 2 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@heschi
Copy link
Contributor

heschi commented Dec 21, 2018

What version of Go are you using (go version)?

$ go version
go version devel +90dca98d33 Thu Dec 20 22:11:45 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

Think so.

What did you do?

time ~/go/bin/go list -e -json -compiled -x net >/dev/null      
~/go/bin/go list -e -json -compiled -x net > /dev/null  0.14s user 0.07s system 216% cpu 0.094 total

time ~/go/bin/go list -e -json -compiled -find net >/dev/null   
~/go/bin/go list -e -json -compiled -find net > /dev/null  0.45s user 0.27s system 106% cpu 0.674 total

What did you expect to see?

I expected -find to make it faster or at least not slower.

What did you see instead?

It made it slower, because it's rerunning cgo compilation with -find for some reason.

@heschi heschi added the GoCommand cmd/go label Dec 21, 2018
@jayconrod jayconrod added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 21, 2018
@jayconrod jayconrod added this to the Go1.12 milestone Dec 21, 2018
@jayconrod
Copy link
Contributor

When "go list" is invoked with -find, it clears the list of imports for each package matched on the command line. This affects action IDs, since they incorporate dependencies' action IDs. Consequently, the build triggered by -compiled won't find sources cached by "go build".

I don't think there's any reason we shouldn't use sources produced by previous runs of "go list -find -compiled" though. cgo-generated sources are not affected by imported packages, as far as I know.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/155481 mentions this issue: cmd/go: use cached source files in "go list -find -compiled"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants