blob: 4f95ece8d7aaaeb72016d12d273d9c61fe60befe [file] [log] [blame]
cp go.mod go.mod.orig
# 'go list pkg' does not report an error when a retracted version is used.
go list -e -f '{{if .Error}}{{.Error}}{{end}}' ./use
! stdout .
cmp go.mod go.mod.orig
# Nor does 'go build'.
[!short] go build ./use
[!short] ! stderr .
[!short] cmp go.mod go.mod.orig
# Neither 'go list' nor 'go build' should download go.mod from the version
# that would list retractions.
exists $GOPATH/pkg/mod/cache/download/
! exists $GOPATH/pkg/mod/cache/download/
# Importing a package from a module with a retracted latest version will
# select the latest non-retracted version.
go get -d ./use_self_prev
go list -m
stdout '^ v1.1.0$'
exists $GOPATH/pkg/mod/cache/download/
-- go.mod --
go 1.15
require v1.0.0-bad
-- go.sum -- v1.0.0-bad h1:liAW69rbtjY67x2CcNzat668L/w+YGgNX3lhJsWIJis= v1.0.0-bad/go.mod h1:0DvGGofJ9hr1q63cBrOY/jSY52OwhRGA0K47NE80I5Y= v1.1.0 h1:0/8I/GTG+1eJTFeDQ/fUbgrMsVHHyKhh3Z8DSZp1fuA= v1.1.0/go.mod h1:xl2EcklWuZZHVtHWcpzfSJQmnzAGpKZYpA/Wto7SZN4=
-- use/use.go --
package use
import _ ""
-- use_self_prev/use.go --
package use_self_prev
import _ ""