diff options
author | Bryan C. Mills <bcmills@google.com> | 2021-04-07 14:10:46 -0400 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2021-04-08 19:30:34 +0000 |
commit | ecca94a7d1fb4f00101af9831fcb395ed08b6948 (patch) | |
tree | 3f6eaa6eabf6a0f024f852ec10fdd479767e8a6c /src/cmd/go/internal/modload/init.go | |
parent | 96a67450887314cedbd9e8634ad92b76a0443779 (diff) | |
download | go-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/init.go')
-rw-r--r-- | src/cmd/go/internal/modload/init.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index fdfb83646e..777b63841f 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -388,7 +388,7 @@ func LoadModFile(ctx context.Context) *Requirements { Target = module.Version{Path: "command-line-arguments"} targetPrefix = "command-line-arguments" rawGoVersion.Store(Target, latestGoVersion()) - commitRequirements(ctx, newRequirements(nil, nil)) + commitRequirements(ctx, newRequirements(index.depth(), nil, nil)) return requirements } @@ -664,7 +664,7 @@ func requirementsFromModFile(ctx context.Context, f *modfile.File) *Requirements } } module.Sort(roots) - rs := newRequirements(roots, direct) + rs := newRequirements(index.depth(), roots, direct) // If any module path appears more than once in the roots, we know that the // go.mod file needs to be updated even though we have not yet loaded any @@ -672,7 +672,7 @@ func requirementsFromModFile(ctx context.Context, f *modfile.File) *Requirements for _, n := range mPathCount { if n > 1 { var err error - rs, err = updateRoots(ctx, rs.direct, nil, rs) + rs, err = updateRoots(ctx, rs.depth, rs.direct, nil, rs) if err != nil { base.Fatalf("go: %v", err) } |