-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Description
Context
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.
Proposal
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.
bcmills, tmthrgd, mvdan, komuw, prashantv and 3 moreleitzler, bcmills, tdakkota and jgao54