| 1 |
# Verifies golang.org/issue/37574. |
| 2 |
|
| 3 |
# If we are already using an +incompatible version, we shouldn't look up |
| 4 |
# a lower compatible version when upgrading. |
| 5 |
cp go.mod go.mod.orig |
| 6 |
go mod tidy |
| 7 |
cmp go.mod.orig go.mod |
| 8 |
grep '^example.com/incompatiblewithsub v2\.0\.0\+incompatible' go.sum |
| 9 |
! grep '^example.com/incompatiblewithsub v1.0.0' go.sum |
| 10 |
|
| 11 |
go get example.com/incompatiblewithsub/sub |
| 12 |
cmp go.mod.orig go.mod |
| 13 |
! grep '^example.com/incompatiblewithsub v1.0.0' go.sum |
| 14 |
|
| 15 |
# TODO(golang.org/issue/31580): the 'go get' command above should not change |
| 16 |
# go.sum. However, as part of the query above, we download [email protected], |
| 17 |
# an unrelated module, since it's a possible prefix. The sum for that module |
| 18 |
# should not be written to go.sum. |
| 19 |
|
| 20 |
-- go.mod -- |
| 21 |
module m |
| 22 |
|
| 23 |
go 1.15 |
| 24 |
|
| 25 |
require example.com/incompatiblewithsub v2.0.0+incompatible |
| 26 |
-- use.go -- |
| 27 |
package use |
| 28 |
|
| 29 |
import _ "example.com/incompatiblewithsub/sub" |