aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2021-02-19 14:41:02 -0500
committerBryan C. Mills <bcmills@google.com>2021-02-25 17:28:44 +0000
commit3137da82fd74d534fff59092329c0ca820ff6589 (patch)
treea4e026625da524e80afa47df7a6a343bf4aeab03 /src
parent2c4c189bba57a4a72c371afa7e544c16abd76ffa (diff)
downloadgo-3137da82fd74d534fff59092329c0ca820ff6589.tar.xz
cmd/go: add a script test corresponding to the downhiddenartifact MVS test
For #36460 Change-Id: I95abff45bb325732a19eb8b9c0d3fc34df08b4d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294293 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/testdata/script/mod_get_downup_pseudo_artifact.txt132
1 files changed, 132 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/mod_get_downup_pseudo_artifact.txt b/src/cmd/go/testdata/script/mod_get_downup_pseudo_artifact.txt
new file mode 100644
index 0000000000..d773f6bd4d
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_get_downup_pseudo_artifact.txt
@@ -0,0 +1,132 @@
+# This test illustrates a case where an upgrade–downgrade–upgrade cycle could
+# add extraneous dependencies due to another module depending on an
+# otherwise-unlisted version (such as a pseudo-version).
+#
+# This case corresponds to the "downhiddenartifact" test in the mvs package.
+
+# The initial package import graph used in the test looks like:
+#
+# a --- b
+# \ \
+# \ \
+# c --- d
+#
+# The module dependency graph initially looks like:
+#
+# a --- b.3
+# \ \
+# \ \
+# c.2 --- d.2
+#
+# c.1 --- b.2 (pseudo)
+#
+# b.1 --- e.1
+
+cp go.mod go.mod.orig
+go mod tidy
+cmp go.mod.orig go.mod
+
+go get -d example.net/d@v0.1.0
+
+go list -m all
+stdout '^example.net/b v0.2.1-0.20210219000000-000000000000 '
+stdout '^example.net/c v0.1.0 '
+stdout '^example.net/d v0.1.0 '
+
+ # BUG: A dependency on e is added even though nothing requires it.
+stdout '^example.net/e '
+
+go mod why -m example.net/e
+stdout '^\(main module does not need module example.net/e\)'
+
+-- go.mod --
+module example.net/a
+
+go 1.16
+
+require (
+ example.net/b v0.3.0
+ example.net/c v0.2.0
+)
+
+replace (
+ example.net/b v0.1.0 => ./b1
+ example.net/b v0.2.1-0.20210219000000-000000000000 => ./b2
+ example.net/b v0.3.0 => ./b3
+ example.net/c v0.1.0 => ./c1
+ example.net/c v0.2.0 => ./c2
+ example.net/d v0.1.0 => ./d
+ example.net/d v0.2.0 => ./d
+ example.net/e v0.1.0 => ./e
+)
+-- a.go --
+package a
+
+import (
+ _ "example.net/b"
+ _ "example.net/c"
+)
+
+-- b1/go.mod --
+module example.net/b
+
+go 1.16
+
+require example.net/e v0.1.0
+-- b1/b.go --
+package b
+
+import _ "example.net/e"
+
+-- b2/go.mod --
+module example.net/b
+
+go 1.16
+-- b2/b.go --
+package b
+
+-- b3/go.mod --
+module example.net/b
+
+go 1.16
+
+require example.net/d v0.2.0
+-- b3/b.go --
+package b
+
+import _ "example.net/d"
+-- c1/go.mod --
+module example.net/c
+
+go 1.16
+
+require example.net/b v0.2.1-0.20210219000000-000000000000
+-- c1/c.go --
+package c
+
+import _ "example.net/b"
+
+-- c2/go.mod --
+module example.net/c
+
+go 1.16
+
+require example.net/d v0.2.0
+-- c2/c.go --
+package c
+
+import _ "example.net/d"
+
+-- d/go.mod --
+module example.net/d
+
+go 1.16
+-- d/d.go --
+package d
+
+-- e/go.mod --
+module example.net/e
+
+go 1.16
+-- e/e.go --
+package e