I propose to change cmd/go to avoid loading transitive module dependencies
that have no observable effect on the packages to be built.
The key insights that lead to this approach are:
-
If no package in a given dependency module is ever (even transitively)
imported by any package loaded by an invocation of the go command, then an
incompatibility between any package in that dependency and any other package
has no observable effect in the resulting program(s). Therefore, we can
safely ignore the (transitive) requirements of any module that does not
contribute any package to the build.
-
We can use the explicit requirements of the main module as a coarse filter
on the set of modules relevant to the main module and to previous
invocations of the go command.
Based on those insights, I propose to change the go command to retain more
transitive dependencies in go.mod files and to avoid loading go.mod files
for “irrelevant” modules, while still maintaining high reproducibility for build
and test operations.
Design doc: http://golang.org/design/36460-lazy-module-loading.
I propose to change
cmd/goto avoid loading transitive module dependenciesthat have no observable effect on the packages to be built.
The key insights that lead to this approach are:
If no package in a given dependency module is ever (even transitively)
imported by any package loaded by an invocation of the
gocommand, then anincompatibility between any package in that dependency and any other package
has no observable effect in the resulting program(s). Therefore, we can
safely ignore the (transitive) requirements of any module that does not
contribute any package to the build.
We can use the explicit requirements of the main module as a coarse filter
on the set of modules relevant to the main module and to previous
invocations of the
gocommand.Based on those insights, I propose to change the
gocommand to retain moretransitive dependencies in
go.modfiles and to avoid loadinggo.modfilesfor “irrelevant” modules, while still maintaining high reproducibility for build
and test operations.
Design doc: http://golang.org/design/36460-lazy-module-loading.