...
Text file
src/cmd/go/testdata/script/work_vendor_modules_txt_consistent.txt
1go work vendor
2cmp modules.txt.want vendor/modules.txt
3go list example.com/a example.com/b
4
5# Module required in go.mod but not marked explicit in modules.txt
6cp modules.txt.required_but_not_explicit vendor/modules.txt
7! go list example.com/a example.com/b
8cmpenv stderr required_but_not_explicit_error.txt
9
10# Replacement in go.mod but no replacement in modules.txt
11cp modules.txt.missing_replacement vendor/modules.txt
12! go list example.com/a example.com/b
13cmpenv stderr missing_replacement_error.txt
14
15# Replacement in go.mod but different replacement target in modules.txt
16cp modules.txt.different_replacement vendor/modules.txt
17! go list example.com/a example.com/b
18cmpenv stderr different_replacement_error.txt
19
20# Module marked explicit in modules.txt but not required in go.mod
21cp modules.txt.extra_explicit vendor/modules.txt
22! go list example.com/a example.com/b
23cmpenv stderr extra_explicit_error.txt
24
25# Replacement in modules.txt but not in go.mod
26cp modules.txt.extra_replacement vendor/modules.txt
27! go list example.com/a example.com/b
28cmpenv stderr extra_replacement_error.txt
29
30-- modules.txt.want --
31## workspace
32# example.com/p v1.0.0 => ./p
33## explicit; go 1.21
34# example.com/q v1.0.0 => ./q
35## explicit; go 1.21
36-- modules.txt.required_but_not_explicit --
37## workspace
38# example.com/p v1.0.0 => ./p
39## go 1.21
40# example.com/q v1.0.0 => ./q
41## explicit; go 1.21
42-- required_but_not_explicit_error.txt --
43go: inconsistent vendoring in $GOPATH${/}src:
44 example.com/p@v1.0.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
45
46 To ignore the vendor directory, use -mod=readonly or -mod=mod.
47 To sync the vendor directory, run:
48 go work vendor
49-- modules.txt.missing_replacement --
50## workspace
51# example.com/p v1.0.0
52## explicit; go 1.21
53# example.com/q v1.0.0 => ./q
54## explicit; go 1.21
55-- missing_replacement_error.txt --
56go: inconsistent vendoring in $GOPATH${/}src:
57 example.com/p@v1.0.0: is replaced in a${/}go.mod, but not marked as replaced in vendor/modules.txt
58
59 To ignore the vendor directory, use -mod=readonly or -mod=mod.
60 To sync the vendor directory, run:
61 go work vendor
62-- modules.txt.different_replacement --
63## workspace
64# example.com/p v1.0.0 => ./r
65## explicit; go 1.21
66# example.com/q v1.0.0 => ./q
67## explicit; go 1.21
68-- different_replacement_error.txt --
69go: inconsistent vendoring in $GOPATH${/}src:
70 example.com/p@v1.0.0: is replaced by ../p in a${/}go.mod, but marked as replaced by ./r in vendor/modules.txt
71
72 To ignore the vendor directory, use -mod=readonly or -mod=mod.
73 To sync the vendor directory, run:
74 go work vendor
75-- modules.txt.extra_explicit --
76## workspace
77# example.com/p v1.0.0 => ./p
78## explicit; go 1.21
79# example.com/q v1.0.0 => ./q
80## explicit; go 1.21
81# example.com/r v1.0.0
82example.com/r
83## explicit; go 1.21
84-- extra_explicit_error.txt --
85go: inconsistent vendoring in $GOPATH${/}src:
86 example.com/r@v1.0.0: is marked as explicit in vendor/modules.txt, but not explicitly required in a go.mod
87
88 To ignore the vendor directory, use -mod=readonly or -mod=mod.
89 To sync the vendor directory, run:
90 go work vendor
91-- modules.txt.extra_replacement --
92## workspace
93# example.com/p v1.0.0 => ./p
94## explicit; go 1.21
95# example.com/q v1.0.0 => ./q
96## explicit; go 1.21
97# example.com/r v1.0.0 => ./r
98example.com/r
99## go 1.21
100-- extra_replacement_error.txt --
101go: inconsistent vendoring in $GOPATH${/}src:
102 example.com/r@v1.0.0: is marked as replaced in vendor/modules.txt, but not replaced in the workspace
103
104 To ignore the vendor directory, use -mod=readonly or -mod=mod.
105 To sync the vendor directory, run:
106 go work vendor
107-- go.work --
108go 1.21
109
110use (
111 ./a
112 ./b
113)
114-- a/go.mod --
115module example.com/a
116
117go 1.21
118
119require example.com/p v1.0.0
120
121replace example.com/p v1.0.0 => ../p
122-- a/a.go --
123package p
124-- b/go.mod --
125module example.com/b
126
127go 1.21
128
129require example.com/q v1.0.0
130
131replace example.com/q v1.0.0 => ../q
132-- b/b.go --
133package b
134-- p/go.mod --
135module example.com/p
136
137go 1.21
138-- q/go.mod --
139module example.com/q
140
141go 1.21
View as plain text