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
heschik opened this issue Dec 21, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@heschik
Copy link
Contributor

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.

@heschik heschik added the GoCommand label Dec 21, 2018

@jayconrod jayconrod added the NeedsFix label Dec 21, 2018

@jayconrod jayconrod added this to the Go1.12 milestone Dec 21, 2018

@jayconrod

This comment has been minimized.

Copy link
Contributor

commented Dec 21, 2018

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

This comment has been minimized.

Copy link

commented Dec 21, 2018

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 join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.