blob: 1820af62ad809b8e8d553908c35d04df6f79eadd [file] [log] [blame]
env GO111MODULE=on
# Before vendoring, we expect to see the original directory.
go list -f '{{with .Module}}{{.Version}}{{end}} {{.Dir}}'
stdout 'v3.0.0'
stdout '.*[/\\][/\\]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/ local/
go list -mod=vendor -f '{{with .Module}}{{.Version}}{{end}} {{.Dir}}'
stdout 'v3.0.0'
stdout '.*[/\\]vendor[/\\][/\\]quote[/\\]v3'
! stderr 'finding'
! stderr 'lookup disabled'
# 'go list' should provide the original replacement directory as the module's
# replacement path.
go list -mod=vendor -f '{{with .Module}}{{with .Replace}}{{.Path}}{{end}}{{end}}'
stdout '.*[/\\][/\\]quote[/\\]v3'
# The same module can't be used as two different paths.
cd multiple-paths
! go mod vendor
stderr ' used for two different module paths \( and\)'
-- go.mod --
require v3.0.0
replace => ./local/
-- imports.go --
package replace
import _ ""
-- local/ --
-- local/ --
package quote
-- multiple-paths/main.go --
package main
import (
func main() {
-- multiple-paths/go.mod --
module quoter
require ( v3.0.0 v3.0.0
replace => v3.0.0
-- multiple-paths/go.sum -- v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= v3.0.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=