1 env 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
8 go mod download github.com/dmitshur-test/modtest5@v0.0.0-20190619020302-197a620e0c9a
9 go mod download github.com/dmitshur-test/modtest5@v0.5.0-alpha
10 go mod download github.com/dmitshur-test/modtest5@v0.5.0-alpha.0.20190619023908-3da23a9deb9e
11 cmp $GOPATH/pkg/mod/cache/download/github.com/dmitshur-test/modtest5/@v/list $WORK/modtest5.list
12
13 env GOSUMDB=off # don't verify go.mod files when loading retractions
14 env GOPROXY=file:///$GOPATH/pkg/mod/cache/download
15 env GOPATH=$WORK/gopath2
16 mkdir $GOPATH
17
18 go list -m -f '{{.Path}} {{.Version}} {{.Time.Format "2006-01-02"}}' github.com/dmitshur-test/modtest5@latest
19 stdout '^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.
24 env GOPROXY=file:///$WORK/tinyproxy
25 go list -m -f '{{.Path}} {{.Version}} {{.Time.Format "2006-01-02"}}' dmitri.shuralyov.com/test/modtest3@latest
26 stdout '^dmitri.shuralyov.com/test/modtest3 v0.0.0-20181023043359-a85b471d5412 2018-10-22$'
27
28 -- $WORK/modtest5.list --
29 v0.0.0-20190619020302-197a620e0c9a
30 v0.5.0-alpha
31 v0.5.0-alpha.0.20190619023908-3da23a9deb9e
32 -- $WORK/tinyproxy/dmitri.shuralyov.com/test/modtest3/@v/list --
33 v0.1.0-0.20161023043300-000000000000
34 v0.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 }
40
View as plain text