aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_multirepo.txt
blob: 0f335a11f0fb3bf3d2ecf2abc81b10ee3c3b1da9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
env GO111MODULE=on

# initial standalone module should use no downloaded modules
go list -deps -f {{.Dir}}
! stdout 'pkg[\\/]mod'

# v2 import should use a downloaded module
# both without an explicit go.mod entry ...
cp tmp/use_v2.go x.go
go get -d .
go list -deps -f {{.Dir}}
stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'

# ... and with one ...
cp tmp/use_v2.mod go.mod
go list -deps -f {{.Dir}}
stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'

# ... and even if there is a v2 module in a subdirectory.
mkdir v2
cp x.go v2/x.go
cp tmp/v2.mod v2/go.mod
go list -deps -f {{.Dir}}
stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'

-- go.mod --
module rsc.io/quote

-- x.go --
package quote

-- tmp/use_v2.go --
package quote
import _ "rsc.io/quote/v2"

-- tmp/use_v2.mod --
module rsc.io/quote
require rsc.io/quote/v2 v2.0.1

-- tmp/v2.mod --
package rsc.io/quote/v2