...
Text file
src/cmd/go/testdata/script/work_vendor_main_module_replaced.txt
1# This is a test that if one of the main modules replaces the other
2# the vendor consistency checks still pass. The replacement is ignored
3# because it is of a main module, but it is still recorded in
4# vendor/modules.txt.
5
6go work vendor
7go list all # make sure the consistency checks pass
8! stderr .
9
10# Removing the replace causes consistency checks to fail
11cp a_go_mod_no_replace a/go.mod
12! go list all # consistency checks fail
13stderr 'example.com/b@v0.0.0: is marked as replaced in vendor/modules.txt, but not replaced in the workspace'
14
15
16-- a_go_mod_no_replace --
17module example.com/a
18
19go 1.21
20
21require example.com/b v0.0.0
22-- go.work --
23go 1.21
24
25use (
26 a
27 b
28)
29-- a/go.mod --
30module example.com/a
31
32go 1.21
33
34require example.com/b v0.0.0
35
36replace example.com/b => ../b
37-- a/a.go --
38package a
39
40import _ "example.com/b"
41-- b/go.mod --
42module example.com/b
43
44go 1.21
45-- b/b.go --
46package b
View as plain text