| 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. |
| 9 |
go list -m -versions rsc.io/breaker |
| 10 |
stdout '^rsc.io/breaker v1.0.0 v2.0.0\+incompatible$' |
| 11 |
go mod download rsc.io/[email protected] |
| 12 |
! grep '^go' $GOPATH/pkg/mod/cache/download/rsc.io/breaker/@v/v1.0.0.mod |
| 13 |
go mod download rsc.io/[email protected]+incompatible |
| 14 |
! grep '^go' $GOPATH/pkg/mod/cache/download/rsc.io/breaker/@v/v2.0.0+incompatible.mod |
| 15 |
|
| 16 |
# Delete downloaded .zip files. |
| 17 |
go clean -modcache |
| 18 |
|
| 19 |
# Check for updates. |
| 20 |
go list -m -u rsc.io/breaker |
| 21 |
stdout '^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 -- |
| 28 |
module m |
| 29 |
|
| 30 |
go 1.16 |
| 31 |
|
| 32 |
require rsc.io/breaker v1.0.0 |
| 33 |
-- go.sum -- |
| 34 |
rsc.io/breaker v1.0.0/go.mod h1:s5yxDXvD88U1/ESC23I2FK3Lkv4YIKaB1ij/Hbm805g= |