...

Text file src/cmd/go/testdata/script/mod_list_pseudo.txt

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2
     3# Regression test for golang.org/issue/32715.
     4
     5# When using $GOPATH/pkg/mod/cache/download as a proxy,
     6# 'latest' queries should prefer tagged versions over pseudo-versions.
     7
     8go mod download github.com/dmitshur-test/modtest5@v0.0.0-20190619020302-197a620e0c9a
     9go mod download github.com/dmitshur-test/modtest5@v0.5.0-alpha
    10go mod download github.com/dmitshur-test/modtest5@v0.5.0-alpha.0.20190619023908-3da23a9deb9e
    11cmp $GOPATH/pkg/mod/cache/download/github.com/dmitshur-test/modtest5/@v/list $WORK/modtest5.list
    12
    13env GOSUMDB=off # don't verify go.mod files when loading retractions
    14env GOPROXY=file:///$GOPATH/pkg/mod/cache/download
    15env GOPATH=$WORK/gopath2
    16mkdir $GOPATH
    17
    18go list -m -f '{{.Path}} {{.Version}} {{.Time.Format "2006-01-02"}}' github.com/dmitshur-test/modtest5@latest
    19stdout '^github.com/dmitshur-test/modtest5 v0.5.0-alpha 2019-06-18$'
    20
    21# If the module proxy contains only pseudo-versions, 'latest' should stat
    22# the version with the most recent timestamp — not the highest semantic
    23# version — and return its metadata.
    24env GOPROXY=file:///$WORK/tinyproxy
    25go list -m -f '{{.Path}} {{.Version}} {{.Time.Format "2006-01-02"}}' dmitri.shuralyov.com/test/modtest3@latest
    26stdout '^dmitri.shuralyov.com/test/modtest3 v0.0.0-20181023043359-a85b471d5412 2018-10-22$'
    27
    28-- $WORK/modtest5.list --
    29v0.0.0-20190619020302-197a620e0c9a
    30v0.5.0-alpha
    31v0.5.0-alpha.0.20190619023908-3da23a9deb9e
    32-- $WORK/tinyproxy/dmitri.shuralyov.com/test/modtest3/@v/list --
    33v0.1.0-0.20161023043300-000000000000
    34v0.0.0-20181023043359-a85b471d5412
    35-- $WORK/tinyproxy/dmitri.shuralyov.com/test/modtest3/@v/v0.0.0-20181023043359-a85b471d5412.info --
    36{
    37	"Version": "v0.0.0-20181023043359-a85b471d5412",
    38	"Time": "2018-10-22T21:33:59-07:00"
    39}

View as plain text