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 · 0 comments

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant