cmd/go/internal/modget: avoid queries for workspace modules and verify module using workspace graph #73654
Labels
ToolProposal
Issues describing a requested change to a Go tool or command-line program.
go get
doesn't work well when run from modules in workspace containing unreleased modules.go get
expects to be able to find modules to require to satisfy all imports and also checks that the module can be loaded properly. So when one of the workspace modules is not released, any queries to find imports of packages in that module will fail, andgo get
will not be able to get to finding modules to satisfy imports that are in released modules. Even if we could avoid that, there would be another problem: the final load of the module will not succeed in module mode because the module is missing requirements to satisfy the imports in the unreleased imports.We plan to address the first problem by having
go get
avoid queries to try to satisfy imports from in the work module of packages that exist in the modules used in thego.work
that would be used in workspace mode. This is a little ugly because it does affect the behavior ofgo get
, but it's a minimal change, and results ingo get
only loading the single module's build graph to determine the changesgo.mod
. We will not avoid queries of a package in one of the workspace modules if they are explicitly specified on the command line.We will address the second issue by having
go get
do the final load in workspace mode. Any major issues and missing requirements of packages outside the workspace will still be detected.One case this does not solve, that we may need to keep an eye on, is when multiple workspace modules have missing requirements from different modules outside the workspace. A
go get
in any of those modules will fail.The text was updated successfully, but these errors were encountered: