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' should consider test dependencies in module mode #32037

Closed
jayconrod opened this issue May 14, 2019 · 2 comments
Closed

cmd/go: 'go get' should consider test dependencies in module mode #32037

jayconrod opened this issue May 14, 2019 · 2 comments
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@jayconrod
Copy link
Contributor

Since CL 174099, go get in module mode expands each of its arguments to a set of packages, then upgrades or downgrades the modules providing those packages. If the -u flag is given, modules providing transitively imported packages will also be upgraded, but this does not consider test imports.

In 1.12, go get only considered modules: command line arguments were matched against modules in the build list. There was no need to consider test dependencies, since this is not a meaningful concept at the module level.

With the new behavior, we upgrade fewer modules, and there's no convenient way to upgrade test dependencies for the main module. all is the only pattern that considers test dependencies, and it includes test dependencies for packages in other modules.

I propose we bring back the -t flag in module mode. The description for go get -t in GOPATH mode is:

The -t flag instructs get to also download the packages required to build
the tests for the specified packages.

The change to flip this back on would be pretty small. However, this would be a fairly visible behavioral change after the 1.13 freeze, so perhaps we should wait for 1.14. Alternatively, we could consider test dependencies by default.

cc @rsc @bcmills @thepudds

@jayconrod jayconrod added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. modules labels May 14, 2019
@jayconrod jayconrod added this to the Go1.13 milestone May 14, 2019
@jayconrod jayconrod self-assigned this May 14, 2019
@rsc
Copy link
Contributor

rsc commented May 16, 2019

I think -t is important to bring back given the new -u semantics. It was made irrelevant by the old module semantics but is now relevant again. For Go 1.13.

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label May 16, 2019
@gopherbot gopherbot removed the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label May 16, 2019
@gopherbot
Copy link

Change https://golang.org/cl/177677 mentions this issue: cmd/go: make 'go get -t' consider test dependencies in module mode

@golang golang locked and limited conversation to collaborators May 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants