blob: a52e05bc72e6a8ab77250893f8663c0f05c0b051 [file] [log] [blame]
cp go.mod go.mod.orig
# Populate go.sum.
go mod download
# '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
-- use/use.go --
package use
import _ ""
-- use_self_prev/use.go --
package use_self_prev
import _ ""