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

proposal: cmd/go: narrow 'mod download' default set #44435

danp opened this issue Feb 19, 2021 · 2 comments

proposal: cmd/go: narrow 'mod download' default set #44435

danp opened this issue Feb 19, 2021 · 2 comments


Copy link

@danp danp commented Feb 19, 2021


go mod download is often used in build systems to "warm the cache" so subsequent operations don't need to fetch any more data. However, it can currently download more than expected. See #41431.

In #41431 (comment), @bcmills suggests using go list -test -deps ./... instead. This would only fetch only the modules transitively imported by packages in the main module.

A similar suggestion of go list -test all was made recently in the Gophers slack.


This issue proposes changing the default selection for go mod download to match go list all. This would make go mod download more intuitive for the cache-warming case which typically does not involve needing dependencies' test dependencies.

The current selection could be moved to a flag if necessary.

@gopherbot gopherbot added this to the Proposal milestone Feb 19, 2021
Copy link

@bcmills bcmills commented Feb 19, 2021

@ianlancetaylor ianlancetaylor added this to Incoming in Proposals Feb 24, 2021
@rsc rsc changed the title proposal: change go mod download's default selection proposal: cmd/go: narrow 'mod download' default set May 4, 2021
Copy link

@rsc rsc commented May 4, 2021

For clarity, right now go mod download downloads the modules listed by go list -m all.
This proposal is to limit it to the modules supplying packages for go list all, which is a smaller set.

Note that we would still need to download go.mod files for something like the whole original set,
and those should still be reported in go mod download -json, in entries that would simply omit
the full-source links if the full source was not downloaded.

@rsc rsc moved this from Incoming to Active in Proposals May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants