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 -d' in a lazy module should promote transitive imports of the named package(s) to roots #45979

Open
bcmills opened this issue May 5, 2021 · 2 comments

Comments

@bcmills
Copy link
Member

@bcmills bcmills commented May 5, 2021

(This is a pre-release cleanup needed for #36460, noticed during testing.)

In go 1.17 modules, we maintain the invariant that the modules providing all packages transitively imported by the main module are listed explicitly in its go.mod file.

go get currently adds a requirement on the module(s) providing the package(s) requested on the command line, but not their transitive imports. (This matches the behavior of go get in pre-1.17 modules.)

However, I expect that most users who run go get on a package will intend to actually import that package. If that is the case, then if they are in the default -mod=readonly mode their builds involving that package will fail until they run go mod tidy.

I would rather that go get make the requested package importable right away, with go mod tidy only needed to clean up any extraneous dependencies afterward. To make that work for go 1.17 modules, go get should be changed to add explicit requirements for all of the indirectly-imported packages too.

CC @jayconrod @matloob

@bcmills bcmills added this to the Go1.17 milestone May 5, 2021
@bcmills bcmills self-assigned this May 5, 2021
@dmitshur
Copy link
Contributor

@dmitshur dmitshur commented May 20, 2021

@bcmills Checking in from a release meeting as this a release blocking issue, are there updates on this? Thanks.

@bcmills
Copy link
Member Author

@bcmills bcmills commented May 20, 2021

I'm still planning to do this. Honestly, I'm not sure that it even needs to block the beta — go get doesn't get a whole lot of user testing anyway, and following it with go mod tidy is fine as a workaround.

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
3 participants