github.com/megatontech/mynoteforgo@v0.0.0-20200507084910-5d0c6ea6e890/源码/cmd/go/testdata/script/mod_vendor_replace.txt (about) 1 env GO111MODULE=on 2 3 # Before vendoring, we expect to see the original directory. 4 go list -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3 5 stdout 'v3.0.0' 6 stdout '.*[/\\]not-rsc.io[/\\]quote[/\\]v3' 7 8 # Since all dependencies are replaced, 'go mod vendor' should not 9 # have to download anything from the network. 10 go mod vendor 11 ! stderr 'downloading' 12 ! stderr 'finding' 13 14 # After vendoring, we expect to see the replacement in the vendor directory, 15 # without attempting to look up the non-replaced version. 16 cmp vendor/rsc.io/quote/v3/quote.go local/not-rsc.io/quote/v3/quote.go 17 18 go list -mod=vendor -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3 19 stdout 'v3.0.0' 20 stdout '.*[/\\]vendor[/\\]rsc.io[/\\]quote[/\\]v3' 21 ! stderr 'finding' 22 ! stderr 'lookup disabled' 23 24 -- go.mod -- 25 module example.com/replace 26 27 require rsc.io/quote/v3 v3.0.0 28 replace rsc.io/quote/v3 => ./local/not-rsc.io/quote/v3 29 30 -- imports.go -- 31 package replace 32 33 import _ "rsc.io/quote/v3" 34 35 -- local/not-rsc.io/quote/v3/go.mod -- 36 module not-rsc.io/quote/v3 37 38 -- local/not-rsc.io/quote/v3/quote.go -- 39 package quote