1 # Auxiliary test for inclusion of otherwise-unused replacements in
2 # vendor/modules.txt for golang.org/issue/33848.
3 # We need metadata about replacements in order to verify that modules.txt
4 # remains in sync with the main module's go.mod file.
5
6 env GO111MODULE=on
7
8 go mod vendor
9 cmp go1.14-modules.txt vendor/modules.txt
10
11 -- go.mod --
12 module example.com/foo
13 go 1.14
14
15 require (
16 example.com/a v0.1.0
17 )
18
19 replace (
20 example.com/a v0.1.0 => ./a
21 example.com/b v0.1.0 => ./b1
22 example.com/b v0.2.0-unused => ./b2
23 example.com/c => ./c
24 example.com/d v0.1.0 => ./d1
25 example.com/d v0.2.0 => ./d2
26 example.com/e => example.com/e v0.1.0-unused
27 )
28 -- foo.go --
29 package foo
30 import _ "example.com/a"
31 -- a/go.mod --
32 module example.com/a
33 require (
34 example.com/b v0.1.0 // indirect
35 example.com/c v0.1.0 // indirect
36 )
37 -- a/a.go --
38 package a
39 import _ "example.com/d"
40 -- b1/go.mod --
41 module example.com/b
42 require example.com/d v0.1.0
43 -- b2/go.mod --
44 module example.com/b
45 require example.com/c v0.2.0
46 -- c/go.mod --
47 module example.com/c
48 require example.com/d v0.2.0
49 -- d1/go.mod --
50 module example.com/d
51 -- d1/d1.go --
52 package d
53 -- d2/go.mod --
54 module example.com/d
55 -- d2/d2.go --
56 package d
57 -- go1.14-modules.txt --
58 # example.com/a v0.1.0 => ./a
59 ## explicit
60 example.com/a
61 # example.com/d v0.2.0 => ./d2
62 example.com/d
63 # example.com/b v0.1.0 => ./b1
64 # example.com/b v0.2.0-unused => ./b2
65 # example.com/c => ./c
66 # example.com/d v0.1.0 => ./d1
67 # example.com/e => example.com/e v0.1.0-unused
68
View as plain text