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 get' of non-main packages outside of a module is confusing in module mode #47290

bcmills opened this issue Jul 19, 2021 · 1 comment
GoCommand modules NeedsInvestigation


Copy link

@bcmills bcmills commented Jul 19, 2021

In module mode today, go get on a non-main package downloads that package to the module cache, builds that package (until we finish #43684), and leaves it in the build cache.

This behavior can be confusing for users who are working from older, GOPATH-based materials (as in In GOPATH mode this would have cloned the package's source repo to GOPATH/src, but in module mode it instead downloads the module containing the source to a versioned path within GOPATH/pkg/mod.

If go get is invoked on a non-main package in module mode outside of any module, we should probably at least log a message indicating where the source code is now found.

/tmp$ go1.17beta1 env GOMOD

/tmp$ go1.17beta1 get

/tmp$ find $(go1.17beta1 env GOPATH)/src -type f

/tmp$ go clean -modcache

/tmp$ go1.17beta1 get
go: downloading v0.0.0-20210716203947-853a461950ff


CC @jayconrod @matloob

@bcmills bcmills added NeedsInvestigation GoCommand modules labels Jul 19, 2021
@bcmills bcmills added this to the Go1.18 milestone Jul 19, 2021
@bcmills bcmills self-assigned this Jul 19, 2021
Copy link

@ianlancetaylor ianlancetaylor commented Jan 28, 2022

@bcmills This is in the 1.18 milestone; time to move to 1.19? Thanks.

@bcmills bcmills removed this from the Go1.18 milestone Jan 29, 2022
@bcmills bcmills added this to the Go1.19 milestone Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
GoCommand modules NeedsInvestigation
None yet

No branches or pull requests

2 participants