-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go install cache on vendor packages not used #14323
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
Comments
I tried on darwin/amd64 and windows/amd64 and was unable to reproduce this problem. Specifically, I created $GOPATH/src/buggy/p.go containing:
and then I ran:
and then I ran:
and the rebuild of buggy does not rebuild go-sqlite3. If I change p.go to say I'd like to fix this but I can't without reproducing it. Can you link to the exact code you are using and show the exact commands you are running? Thanks. |
With those steps, the issue doesn't appear. I modified them to reproduce the issue by changing
As the unvendored source is still in src/, it looks like the Some tools, at least govendor, don't remove the unvendored source when vendoring a package. Perhaps installing a package by name when both unvendored and vendored source are available should result in an error due to ambiguity? |
Great, thanks. As I understand it now, the report concerns this command sequence:
Specifically, the report is that the first command installs the non-vendored go-sqlite3 and the second one builds and installs the vendored copy. If so, that's working as intended. On the go command line, paths are always interpreted relative to GOROOT/GOPATH roots, not vendor directories. The canonical path for a vendored package includes the .../vendor/ prefix even though source code-level import references do not. That is, on the command line, 'github.com/mattn/go-sqlite3' always means the unvendored copy of go-sqlite3, while buggy/vendor/github.com/mattn/go-sqlite3 is a vendored copy. You'll see these expanded paths in the output of 'go list -json' or 'go list all' as well. What would be unintended is if the second of any of these command pairs printed anything at all (the first should do all the work):
Can you confirm that on your system those are all correctly doing nothing the second time? Thanks. |
Ah, I see what you mean. I expected package names to check the vendor directory first rather than prefixing them with buggy/vendor/. That makes sense. The pairs you posted are working as they should. Maybe when vendored packages have a naming collision with an unvendored package present in the same GOPATH, it would worth putting a warning when building to avoid this kind of confusion? I'm closing this issue as it's solved. Thanks! |
When vendoring a large package such as github.com/mattn/go-sqlite3,
go install
will generate the appropriate cache file in $GOPATH/pkg but this will not be used.This is present under
go1.6rc2 windows/amd64
as well asgo1.5.3
. The cache is used whenGO15VENDOREXPERIMENT=0
. I've checked this withgo build -v
. The environment is windows/amd64 under cygwin. I used govendor to vendor the go-sqlite3 package.Compile time went from ~2s to ~36s for me.
The text was updated successfully, but these errors were encountered: