1
0
mirror of https://github.com/golang/go synced 2024-11-23 04:30:03 -07:00

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 <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Bryan C. Mills 2020-12-03 11:09:07 -05:00
parent bdc9a837e9
commit 7f5a3196c9

View File

@ -25,10 +25,11 @@ import (
"golang.org/x/mod/semver" "golang.org/x/mod/semver"
) )
// lazyLoadingVersion is the Go version (plus leading "v") at which lazy module // narrowAllVersionV is the Go version (plus leading "v") at which the
// loading takes effect. // module-module "all" pattern no longer closes over the dependencies of
const lazyLoadingVersionV = "v1.16" // tests outside of the main module.
const go116EnableLazyLoading = true const narrowAllVersionV = "v1.16"
const go116EnableNarrowAll = true
var modFile *modfile.File 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 // (Otherwise — as in Go 1.16+ — the "all" pattern includes only the packages
// transitively *imported by* the packages and tests in the main module.) // transitively *imported by* the packages and tests in the main module.)
func (i *modFileIndex) allPatternClosesOverTests() bool { func (i *modFileIndex) allPatternClosesOverTests() bool {
if !go116EnableLazyLoading { if !go116EnableNarrowAll {
return true 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 // 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 // continue to use the older interpretation. (If i == nil, we not in any
// module at all and should use the latest semantics.) // module at all and should use the latest semantics.)