...
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
7go work sync
8cmp a/go.mod a/want_go.mod
9cmp b/go.mod b/want_go.mod
10
11-- go.work --
12go 1.18
13
14use (
15 ./a
16 ./b
17)
18
19-- a/go.mod --
20go 1.18
21
22module example.com/a
23
24require (
25 example.com/p v1.1.0
26)
27
28replace (
29 example.com/p => ../p
30)
31-- a/want_go.mod --
32go 1.18
33
34module example.com/a
35
36require (
37 example.com/p v1.1.0
38)
39
40replace (
41 example.com/p => ../p
42)
43-- a/a.go --
44package a
45
46import (
47 "example.com/p"
48)
49
50func Foo() {
51 p.P()
52}
53-- b/go.mod --
54go 1.18
55
56module example.com/b
57
58require (
59 example.com/q v1.0.0
60)
61
62replace (
63 example.com/q => ../q
64)
65-- b/want_go.mod --
66go 1.18
67
68module example.com/b
69
70require (
71 example.com/q v1.0.0
72)
73
74replace (
75 example.com/q => ../q
76)
77-- b/b.go --
78package b
79
80import (
81 "example.com/q"
82)
83
84func Foo() {
85 q.Q()
86}
87-- p/go.mod --
88go 1.18
89
90module example.com/p
91-- p/p.go --
92package p
93
94func P() {}
95-- q/go.mod --
96go 1.18
97
98module example.com/q
99
100require (
101 example.com/p v1.0.0
102)
103
104replace (
105 example.com/p => ../p
106)
107-- q/q.go --
108package q
109
110func Q() {
111}
112-- q/q_test.go --
113package q
114
115import example.com/p
116
117func TestQ(t *testing.T) {
118 p.P()
119}
View as plain text