Text file
src/cmd/go/testdata/script/work_sync_check_multiple_paths_once.txt
1 # Test that checkMultiplePaths reports errors exactly once in a workspace with
2 # multiple modules, even though it is called once per workspace module.
3 #
4 # example.com/a and example.com/b are both replaced by ../shared (which
5 # canonicalizes to the same path in workspace mode), triggering a "used for
6 # two different module paths" error. With three workspace modules the check
7 # is called three times; the error should appear in stderr exactly once.
8
9 go work sync
10 stderr -count=1 'used for two different module paths'
11
12 -- go.work --
13 go 1.18
14
15 use (
16 ./m
17 ./n
18 ./o
19 )
20
21 -- m/go.mod --
22 module example.com/m
23
24 go 1.18
25
26 require example.com/a v1.0.0
27
28 replace example.com/a v1.0.0 => ../shared
29
30 -- m/m.go --
31 package m
32
33 -- n/go.mod --
34 module example.com/n
35
36 go 1.18
37
38 require example.com/b v1.0.0
39
40 replace example.com/b v1.0.0 => ../shared
41
42 -- n/n.go --
43 package n
44
45 -- o/go.mod --
46 module example.com/o
47
48 go 1.18
49
50 -- o/o.go --
51 package o
52
53 -- shared/go.mod --
54 module example.com/shared
55
56 go 1.18
57
View as plain text