...
1# When finding the latest version of a module, we should not download version
2# contents. Previously, we downloaded .zip files to determine whether a real
3# .mod file was present in order to decide whether +incompatible versions
4# could be "latest".
5#
6# Verifies #47377.
7
8# rsc.io/breaker has two versions, neither of which has a .mod file.
9go list -m -versions rsc.io/breaker
10stdout '^rsc.io/breaker v1.0.0 v2.0.0\+incompatible$'
11go mod download rsc.io/breaker@v1.0.0
12! grep '^go' $GOPATH/pkg/mod/cache/download/rsc.io/breaker/@v/v1.0.0.mod
13go mod download rsc.io/breaker@v2.0.0+incompatible
14! grep '^go' $GOPATH/pkg/mod/cache/download/rsc.io/breaker/@v/v2.0.0+incompatible.mod
15
16# Delete downloaded .zip files.
17go clean -modcache
18
19# Check for updates.
20go list -m -u rsc.io/breaker
21stdout '^rsc.io/breaker v1.0.0 \[v2.0.0\+incompatible\]$'
22
23# We should not have downloaded zips.
24! exists $GOPATH/pkg/mod/cache/download/rsc.io/breaker/@v/v1.0.0.zip
25! exists $GOPATH/pkg/mod/cache/download/rsc.io/breaker/@v/v2.0.0+incompatible.zip
26
27-- go.mod --
28module m
29
30go 1.16
31
32require rsc.io/breaker v1.0.0
33-- go.sum --
34rsc.io/breaker v1.0.0/go.mod h1:s5yxDXvD88U1/ESC23I2FK3Lkv4YIKaB1ij/Hbm805g=
View as plain text