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

Open
bcmills opened this issue Jul 19, 2021 · 1 comment
Assignees
Labels
GoCommand modules NeedsInvestigation
Milestone

Comments

@bcmills
Copy link
Member

@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 https://stackoverflow.com/q/68420141). 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
/dev/null

/tmp$ go1.17beta1 get golang.org/x/net/html

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

/tmp$ go clean -modcache

/tmp$ go1.17beta1 get golang.org/x/net/html
go: downloading golang.org/x/net v0.0.0-20210716203947-853a461950ff

/tmp$

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

@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
Labels
GoCommand modules NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

2 participants