summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt
blob: 6bc1c77ed3d0d76e8d52242dd253370af0092034 (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
env GO111MODULE=on

# Before vendoring, we expect to see the original directory.
go list -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3
stdout 'v3.0.0'
stdout '.*[/\\]not-rsc.io[/\\]quote[/\\]v3'

# Since all dependencies are replaced, 'go mod vendor' should not
# have to download anything from the network.
go mod vendor
! stderr 'downloading'
! stderr 'finding'

# After vendoring, we expect to see the replacement in the vendor directory,
# without attempting to look up the non-replaced version.
cmp vendor/rsc.io/quote/v3/quote.go local/not-rsc.io/quote/v3/quote.go

go list -mod=vendor -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3
stdout 'v3.0.0'
stdout '.*[/\\]vendor[/\\]rsc.io[/\\]quote[/\\]v3'
! stderr 'finding'
! stderr 'lookup disabled'

-- go.mod --
module example.com/replace

require rsc.io/quote/v3 v3.0.0
replace rsc.io/quote/v3 => ./local/not-rsc.io/quote/v3

-- imports.go --
package replace

import _ "rsc.io/quote/v3"

-- local/not-rsc.io/quote/v3/go.mod --
module not-rsc.io/quote/v3

-- local/not-rsc.io/quote/v3/quote.go --
package quote