1 # Conflicting replaces in workspace modules returns error that suggests
2 # overriding it in the go.work file.
3
4 ! go list -m example.com/dep
5 stderr 'go: conflicting replacements for example.com/dep@v1.0.0:\n\t'$PWD${/}'dep1\n\t'$PWD${/}'dep2\nuse "go work edit -replace example.com/dep@v1.0.0=\[override\]" to resolve'
6 go work edit -replace example.com/dep@v1.0.0=./dep1
7 go list -m example.com/dep
8 stdout 'example.com/dep v1.0.0 => ./dep1'
9
10 -- foo --
11 -- go.work --
12 use m
13 use n
14 -- m/go.mod --
15 module example.com/m
16
17 require example.com/dep v1.0.0
18 replace example.com/dep v1.0.0 => ../dep1
19 -- m/m.go --
20 package m
21
22 import "example.com/dep"
23
24 func F() {
25 dep.G()
26 }
27 -- n/go.mod --
28 module example.com/n
29
30 require example.com/dep v1.0.0
31 replace example.com/dep v1.0.0 => ../dep2
32 -- n/n.go --
33 package n
34
35 import "example.com/dep"
36
37 func F() {
38 dep.G()
39 }
40 -- dep1/go.mod --
41 module example.com/dep
42 -- dep1/dep.go --
43 package dep
44
45 func G() {
46 }
47 -- dep2/go.mod --
48 module example.com/dep
49 -- dep2/dep.go --
50 package dep
51
52 func G() {
53 }
54
View as plain text