summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/go/testdata/script/work_sync_irrelevant_dependency.txt
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/cmd/go/testdata/script/work_sync_irrelevant_dependency.txt')
-rw-r--r--libgo/go/cmd/go/testdata/script/work_sync_irrelevant_dependency.txt119
1 files changed, 119 insertions, 0 deletions
diff --git a/libgo/go/cmd/go/testdata/script/work_sync_irrelevant_dependency.txt b/libgo/go/cmd/go/testdata/script/work_sync_irrelevant_dependency.txt
new file mode 100644
index 00000000000..072323d15da
--- /dev/null
+++ b/libgo/go/cmd/go/testdata/script/work_sync_irrelevant_dependency.txt
@@ -0,0 +1,119 @@
+# Test of go work sync in a workspace in which some dependency needed by `a`
+# appears at a lower version in the build list of `b`, but is not needed at all
+# by `b` (so it should not be upgraded within b).
+#
+# a -> p 1.1
+# b -> q 1.0 -(through a test dependency)-> p 1.0
+go work sync
+cmp a/go.mod a/want_go.mod
+cmp b/go.mod b/want_go.mod
+
+-- go.work --
+go 1.18
+
+use (
+ ./a
+ ./b
+)
+
+-- a/go.mod --
+go 1.18
+
+module example.com/a
+
+require (
+ example.com/p v1.1.0
+)
+
+replace (
+ example.com/p => ../p
+)
+-- a/want_go.mod --
+go 1.18
+
+module example.com/a
+
+require (
+ example.com/p v1.1.0
+)
+
+replace (
+ example.com/p => ../p
+)
+-- a/a.go --
+package a
+
+import (
+ "example.com/p"
+)
+
+func Foo() {
+ p.P()
+}
+-- b/go.mod --
+go 1.18
+
+module example.com/b
+
+require (
+ example.com/q v1.0.0
+)
+
+replace (
+ example.com/q => ../q
+)
+-- b/want_go.mod --
+go 1.18
+
+module example.com/b
+
+require (
+ example.com/q v1.0.0
+)
+
+replace (
+ example.com/q => ../q
+)
+-- b/b.go --
+package b
+
+import (
+ "example.com/q"
+)
+
+func Foo() {
+ q.Q()
+}
+-- p/go.mod --
+go 1.18
+
+module example.com/p
+-- p/p.go --
+package p
+
+func P() {}
+-- q/go.mod --
+go 1.18
+
+module example.com/q
+
+require (
+ example.com/p v1.0.0
+)
+
+replace (
+ example.com/p => ../p
+)
+-- q/q.go --
+package q
+
+func Q() {
+}
+-- q/q_test.go --
+package q
+
+import example.com/p
+
+func TestQ(t *testing.T) {
+ p.P()
+} \ No newline at end of file