From 7f5a3196c92c9fbe6d691d022202cbbda6e7a431 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Thu, 3 Dec 2020 11:09:07 -0500 Subject: [PATCH] cmd/go/internal/modload: rename constants to reflect that lazy loading is not yet implemented Updates #36460 Updates #42288 Change-Id: I82a3b7e97a8e2f83bae2318ca9fb5c38c0c811cd Reviewed-on: https://go-review.googlesource.com/c/go/+/275172 Trust: Bryan C. Mills Run-TryBot: Bryan C. Mills Reviewed-by: Jay Conrod TryBot-Result: Go Bot --- src/cmd/go/internal/modload/modfile.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cmd/go/internal/modload/modfile.go b/src/cmd/go/internal/modload/modfile.go index ede07be4bf..eb05e9f9c9 100644 --- a/src/cmd/go/internal/modload/modfile.go +++ b/src/cmd/go/internal/modload/modfile.go @@ -25,10 +25,11 @@ import ( "golang.org/x/mod/semver" ) -// lazyLoadingVersion is the Go version (plus leading "v") at which lazy module -// loading takes effect. -const lazyLoadingVersionV = "v1.16" -const go116EnableLazyLoading = true +// narrowAllVersionV is the Go version (plus leading "v") at which the +// module-module "all" pattern no longer closes over the dependencies of +// tests outside of the main module. +const narrowAllVersionV = "v1.16" +const go116EnableNarrowAll = true var modFile *modfile.File @@ -296,10 +297,10 @@ func indexModFile(data []byte, modFile *modfile.File, needsFix bool) *modFileInd // (Otherwise — as in Go 1.16+ — the "all" pattern includes only the packages // transitively *imported by* the packages and tests in the main module.) func (i *modFileIndex) allPatternClosesOverTests() bool { - if !go116EnableLazyLoading { + if !go116EnableNarrowAll { return true } - if i != nil && semver.Compare(i.goVersionV, lazyLoadingVersionV) < 0 { + if i != nil && semver.Compare(i.goVersionV, narrowAllVersionV) < 0 { // The module explicitly predates the change in "all" for lazy loading, so // continue to use the older interpretation. (If i == nil, we not in any // module at all and should use the latest semantics.)