aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/modfile.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2021-04-07 16:17:08 -0400
committerBryan C. Mills <bcmills@google.com>2021-04-08 16:55:27 +0000
commit0e09e4143e3d55ac8cbcbf53f1da98b817fc5a58 (patch)
treeebc82882110d4d54cca19f2f2fdd50e219c5a842 /src/cmd/go/internal/modload/modfile.go
parent31d2556273795ae10709d3bc157ec5d3f0e070a2 (diff)
downloadgo-0e09e4143e3d55ac8cbcbf53f1da98b817fc5a58.tar.gz
go-0e09e4143e3d55ac8cbcbf53f1da98b817fc5a58.zip
cmd/go: assume Go 1.16 semantics uniformly for unversioned modules
However, still only trigger -mod=vendor automatically (and only apply the more stringent Go 1.14 vendor consistency checks) if the 'go' version is explicit. This provides maximal compatibility with Go 1.16 and earlier: Go 1.11 modules will continue not to fail vendor consistency checks, but scripts that assume semantics up to Go 1.16 for unversioned modules will continue to work unmodified. Fixes #44976 For #36460 Change-Id: Idb05ca320023f57249c71fc8079218e8991d1ff9 Reviewed-on: https://go-review.googlesource.com/c/go/+/308509 Trust: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/modfile.go')
-rw-r--r--src/cmd/go/internal/modload/modfile.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modload/modfile.go b/src/cmd/go/internal/modload/modfile.go
index 6351871844..3e4772f217 100644
--- a/src/cmd/go/internal/modload/modfile.go
+++ b/src/cmd/go/internal/modload/modfile.go
@@ -291,7 +291,7 @@ 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 i != nil && semver.Compare(i.goVersionV, narrowAllVersionV) < 0 {
+ if i != nil && i.goVersionV != "" && 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.)