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

Comments

Projects
None yet
4 participants
@jayconrod
Copy link
Contributor

commented May 14, 2019

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

@rsc

This comment has been minimized.

Copy link
Contributor

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.

@gopherbot

This comment has been minimized.

Copy link

commented May 16, 2019

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

@gopherbot gopherbot closed this in ab724d4 May 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.