Text file
src/cmd/go/testdata/script/work_sync_irrelevant_dependency.txt
1 # Test of go work sync in a workspace in which some dependency needed by `a`
2 # appears at a lower version in the build list of `b`, but is not needed at all
3 # by `b` (so it should not be upgraded within b).
4 #
5 # a -> p 1.1
6 # b -> q 1.0 -(through a test dependency)-> p 1.0
7 go work sync
8 cmp a/go.mod a/want_go.mod
9 cmp b/go.mod b/want_go.mod
10
11 -- go.work --
12 go 1.18
13
14 use (
15 ./a
16 ./b
17 )
18
19 -- a/go.mod --
20 go 1.18
21
22 module example.com/a
23
24 require (
25 example.com/p v1.1.0
26 )
27
28 replace (
29 example.com/p => ../p
30 )
31 -- a/want_go.mod --
32 go 1.18
33
34 module example.com/a
35
36 require (
37 example.com/p v1.1.0
38 )
39
40 replace (
41 example.com/p => ../p
42 )
43 -- a/a.go --
44 package a
45
46 import (
47 "example.com/p"
48 )
49
50 func Foo() {
51 p.P()
52 }
53 -- b/go.mod --
54 go 1.18
55
56 module example.com/b
57
58 require (
59 example.com/q v1.0.0
60 )
61
62 replace (
63 example.com/q => ../q
64 )
65 -- b/want_go.mod --
66 go 1.18
67
68 module example.com/b
69
70 require (
71 example.com/q v1.0.0
72 )
73
74 replace (
75 example.com/q => ../q
76 )
77 -- b/b.go --
78 package b
79
80 import (
81 "example.com/q"
82 )
83
84 func Foo() {
85 q.Q()
86 }
87 -- p/go.mod --
88 go 1.18
89
90 module example.com/p
91 -- p/p.go --
92 package p
93
94 func P() {}
95 -- q/go.mod --
96 go 1.18
97
98 module example.com/q
99
100 require (
101 example.com/p v1.0.0
102 )
103
104 replace (
105 example.com/p => ../p
106 )
107 -- q/q.go --
108 package q
109
110 func Q() {
111 }
112 -- q/q_test.go --
113 package q
114
115 import example.com/p
116
117 func TestQ(t *testing.T) {
118 p.P()
119 }
View as plain text