aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_tidy_lazy_self.txt
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2021-08-05 15:18:42 -0700
committerJay Conrod <jayconrod@google.com>2021-08-09 20:06:35 +0000
commitf1dce319ffd9d3663f522141abfb9c1ec9d92e04 (patch)
tree057860fa3004ea4556261a2afa213b16de24fa49 /src/cmd/go/testdata/script/mod_tidy_lazy_self.txt
parent7aeaad5c86174f61b084d72d89fb02d7fc64391c (diff)
downloadgo-f1dce319ffd9d3663f522141abfb9c1ec9d92e04.tar.gz
go-f1dce319ffd9d3663f522141abfb9c1ec9d92e04.zip
cmd/go: with -mod=vendor, don't panic if there are duplicate requirements
In loadModFile with -mod=vendor, load the vendor list and use it to initialize the module graph before calling updateRoots. In updateLazyRoots with any mode other than "mod", return the original *Requirements if no roots needed to be upgraded, even if there are inconsistencies. This means 'go list -m -mod=readonly' and -mod=vendor may succeed if there are duplicate requirements or requirements on versions of the main module. Fixes #47565 Change-Id: I4640dffc4a7359367cc910da0d29e3538bfd1ca4 Reviewed-on: https://go-review.googlesource.com/c/go/+/340252 Trust: Jay Conrod <jayconrod@google.com> Trust: Bryan C. Mills <bcmills@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/testdata/script/mod_tidy_lazy_self.txt')
-rw-r--r--src/cmd/go/testdata/script/mod_tidy_lazy_self.txt17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/cmd/go/testdata/script/mod_tidy_lazy_self.txt b/src/cmd/go/testdata/script/mod_tidy_lazy_self.txt
index ffcea18603..9abbabd2eb 100644
--- a/src/cmd/go/testdata/script/mod_tidy_lazy_self.txt
+++ b/src/cmd/go/testdata/script/mod_tidy_lazy_self.txt
@@ -2,18 +2,13 @@
# 'go mod tidy' should not panic if the main module initially
# requires an older version of itself.
+# A module may require an older version of itself without error. This is
+# inconsistent (the required version is never selected), but we still get
+# a reproducible build list.
+go list -m all
+stdout '^golang.org/issue/46078$'
-# A module that explicitly requires an older version of itself should be
-# rejected as inconsistent: we enforce that every explicit requirement is the
-# selected version of its module path, but the selected version of the main
-# module is always itself — not some explicit version.
-
-! go list -m all
-stderr '^go: updates to go\.mod needed; to update it:\n\tgo mod tidy$'
-
-
-# The suggested 'go mod tidy' command should succeed (not crash).
-
+# 'go mod tidy' should fix this (and not crash).
go mod tidy