Text file
src/cmd/go/testdata/script/work_vendor_modules_txt_conditional.txt
1 # This test checks to see if we only start in workspace vendor
2 # mode if the modules.txt specifies ## workspace (and only in
3 # standard vendor if it doesn't).
4
5 # vendor directory produced for workspace, workspace mode
6 # runs in mod=vendor
7 go work vendor
8 cmp vendor/modules.txt want_workspace_modules_txt
9 go list -f {{.Dir}} example.com/b
10 stdout $GOPATH[\\/]src[\\/]vendor[\\/]example.com[\\/]b
11
12 # vendor directory produced for workspace, module mode
13 # runs in mod=readonly
14 env GOWORK=off
15 go list -f {{.Dir}} example.com/b
16 stdout $GOPATH[\\/]src[\\/]b
17
18 # vendor directory produced for module, module mode
19 # runs in mod=vendor
20 go mod vendor
21 cmp vendor/modules.txt want_module_modules_txt
22 go list -f {{.Dir}} example.com/b
23 stdout $GOPATH[\\/]src[\\/]vendor[\\/]example.com[\\/]b
24
25 # vendor directory produced for module, workspace mode
26 # runs in mod=readonly
27 env GOWORK=
28 go list -f {{.Dir}} example.com/b
29 stdout $GOPATH[\\/]src[\\/]b
30
31 -- want_workspace_modules_txt --
32 ## workspace
33 # example.com/b v0.0.0 => ./b
34 ## explicit; go 1.21
35 example.com/b
36 # example.com/b => ./b
37 -- want_module_modules_txt --
38 # example.com/b v0.0.0 => ./b
39 ## explicit; go 1.21
40 example.com/b
41 # example.com/b => ./b
42 -- go.work --
43 go 1.21
44
45 use .
46 -- go.mod --
47 module example.com/a
48
49 go 1.21
50
51 require example.com/b v0.0.0
52 replace example.com/b => ./b
53 -- a.go --
54 package a
55
56 import _ "example.com/b"
57 -- b/go.mod --
58 module example.com/b
59
60 go 1.21
61 -- b/b.go --
62 package b
View as plain text