aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/load.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2021-04-07 14:10:46 -0400
committerBryan C. Mills <bcmills@google.com>2021-04-08 19:30:34 +0000
commitecca94a7d1fb4f00101af9831fcb395ed08b6948 (patch)
tree3f6eaa6eabf6a0f024f852ec10fdd479767e8a6c /src/cmd/go/internal/modload/load.go
parent96a67450887314cedbd9e8634ad92b76a0443779 (diff)
downloadgo-ecca94a7d1fb4f00101af9831fcb395ed08b6948.tar.gz
go-ecca94a7d1fb4f00101af9831fcb395ed08b6948.zip
cmd/go/internal/modload: add a dormant depth type
This change adds the depth constants 'lazy' and 'eager', but leaves the go117EnableLazyLoading constant set to false so that the depth in effect is still always 'eager'. The go117EnableLazyLoading constant can be toggled to true once the module loader has been updated to maintain the lazy-loading invariants in the go.mod file. In the meantime, this will allow me to progressively replace uses of go117LazyTODO with real conditions and locally toggle lazy-mode on to see which tests are still failing (or which behaviors are missing test coverage). For #36460 Change-Id: Ifd358265a3903a5000003c2072f28171f336e15c Reviewed-on: https://go-review.googlesource.com/c/go/+/308515 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/cmd/go/internal/modload/load.go')
-rw-r--r--src/cmd/go/internal/modload/load.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go
index 5bff17e579..5de26c15e7 100644
--- a/src/cmd/go/internal/modload/load.go
+++ b/src/cmd/go/internal/modload/load.go
@@ -537,7 +537,7 @@ func pathInModuleCache(ctx context.Context, dir string, rs *Requirements) string
return path.Join(m.Path, filepath.ToSlash(sub)), true
}
- if go117LazyTODO {
+ if rs.depth == lazy {
for _, m := range rs.rootModules {
if v, _ := rs.rootSelected(m.Path); v != m.Version {
continue // m is a root, but we have a higher root for the same path.
@@ -550,9 +550,9 @@ func pathInModuleCache(ctx context.Context, dir string, rs *Requirements) string
}
}
- // None of the roots contained dir, or we're in eager mode and have already
- // loaded the full module graph. Either way, check the full graph to see if
- // the directory is a non-root dependency.
+ // None of the roots contained dir, or we're in eager mode and want to load
+ // the full module graph more aggressively. Either way, check the full graph
+ // to see if the directory is a non-root dependency.
//
// If the roots are not consistent with the full module graph, the selected
// versions of root modules may differ from what we already checked above.
@@ -1020,7 +1020,7 @@ func (ld *loader) updateRequirements(ctx context.Context) error {
}
}
- rs, err := updateRoots(ctx, direct, ld.pkgs, rs)
+ rs, err := updateRoots(ctx, rs.depth, direct, ld.pkgs, rs)
if err == nil {
ld.requirements = rs
}