...
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
7go work vendor
8cmp vendor/modules.txt want_workspace_modules_txt
9go list -f {{.Dir}} example.com/b
10stdout $GOPATH[\\/]src[\\/]vendor[\\/]example.com[\\/]b
11
12# vendor directory produced for workspace, module mode
13# runs in mod=readonly
14env GOWORK=off
15go list -f {{.Dir}} example.com/b
16stdout $GOPATH[\\/]src[\\/]b
17
18# vendor directory produced for module, module mode
19# runs in mod=vendor
20go mod vendor
21cmp vendor/modules.txt want_module_modules_txt
22go list -f {{.Dir}} example.com/b
23stdout $GOPATH[\\/]src[\\/]vendor[\\/]example.com[\\/]b
24
25# vendor directory produced for module, workspace mode
26# runs in mod=readonly
27env GOWORK=
28go list -f {{.Dir}} example.com/b
29stdout $GOPATH[\\/]src[\\/]b
30
31-- want_workspace_modules_txt --
32## workspace
33# example.com/b v0.0.0 => ./b
34## explicit; go 1.21
35example.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
40example.com/b
41# example.com/b => ./b
42-- go.work --
43go 1.21
44
45use .
46-- go.mod --
47module example.com/a
48
49go 1.21
50
51require example.com/b v0.0.0
52replace example.com/b => ./b
53-- a.go --
54package a
55
56import _ "example.com/b"
57-- b/go.mod --
58module example.com/b
59
60go 1.21
61-- b/b.go --
62package b
View as plain text