-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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 mod download' pulls in test dependencies of dependencies #41431
Comments
This will be resolved by lazy module loading (#36460), but only when the main module and all of its dependencies have It's expected behavior, but it does overfetch, and maybe we can improve it. Perhaps, in addition to #36460, we could narrow the scope of |
If you want to download only those modules that provide packages in |
(And note that if your |
Finally, today you should be able to use |
go mod download will currently overfetch including test dependencies (see golang/go#41431), so, since we barely use this dependency in our tests, we'll skip it for now
I believe this was resolved with #44435. |
Duplicate of #44435 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Run
go mod download
for a module (called go-mod-download-repro in the example) that takes on a dependency on another module (go.uber.org/atomic in the example), which only has external dependencies in tests.go.mod
:main.go
:go.uber.org/atomic has test dependencies on testify.
Download to a local directory to see what is downloaded:
$ GOMODCACHE=$(pwd)/cache go mod download
What did you expect to see?
Expected to see all dependencies of
go-mod-download-repro
to be downloaded, but not the test dependencies of go.uber.org/atomic.What did you see instead?
Only dependenceis required to build/test go-mod-download-repro.
If this behaviour is intentional, would it be possible to add an option to limit the download to just packages needed to build, or to packages needed to test the current module?
The text was updated successfully, but these errors were encountered: