| 1 |
# setup |
| 2 |
env TESTGO_VERSION=go1.99rc1 |
| 3 |
env TESTGO_VERSION_SWITCH=switch |
| 4 |
|
| 5 |
# go get go should use the latest Go 1.23 |
| 6 |
cp go.mod.orig go.mod |
| 7 |
go get go |
| 8 |
stderr '^go: upgraded go 1.21 => 1.23.9$' |
| 9 |
grep 'go 1.23.9' go.mod |
| 10 |
! grep toolchain go.mod |
| 11 |
|
| 12 |
# go get [email protected] should use the latest Go 1.23 |
| 13 |
cp go.mod.orig go.mod |
| 14 |
go get [email protected] |
| 15 |
stderr '^go: upgraded go 1.21 => 1.23.9$' |
| 16 |
grep 'go 1.23.9' go.mod |
| 17 |
! grep toolchain go.mod |
| 18 |
|
| 19 |
# go get [email protected] should use the latest Go 1.22 |
| 20 |
cp go.mod.orig go.mod |
| 21 |
go get [email protected] |
| 22 |
stderr '^go: upgraded go 1.21 => 1.22.9$' |
| 23 |
grep 'go 1.22.9' go.mod |
| 24 |
! grep toolchain1 go.mod |
| 25 |
|
| 26 |
# go get go@patch should use the latest patch release |
| 27 |
go get [email protected] |
| 28 |
go get go@patch |
| 29 |
stderr '^go: upgraded go 1.22.1 => 1.22.9$' |
| 30 |
grep 'go 1.22.9' go.mod |
| 31 |
! grep toolchain go.mod |
| 32 |
|
| 33 |
# go get [email protected] does NOT find the release candidate |
| 34 |
cp go.mod.orig go.mod |
| 35 |
! go get [email protected] |
| 36 |
stderr '^go: [email protected]: no matching versions for query "1.24"$' |
| 37 |
|
| 38 |
# go get [email protected] works |
| 39 |
cp go.mod.orig go.mod |
| 40 |
go get [email protected] |
| 41 |
stderr '^go: upgraded go 1.21 => 1.24rc1$' |
| 42 |
grep 'go 1.24rc1' go.mod |
| 43 |
! grep toolchain go.mod |
| 44 |
|
| 45 |
# go get go@latest finds the latest Go 1.23 |
| 46 |
cp go.mod.orig go.mod |
| 47 |
go get go@latest |
| 48 |
stderr '^go: upgraded go 1.21 => 1.23.9$' |
| 49 |
grep 'go 1.23.9' go.mod |
| 50 |
! grep toolchain go.mod |
| 51 |
|
| 52 |
# Again, with toolchains. |
| 53 |
|
| 54 |
go get [email protected] |
| 55 |
stderr '^go: added toolchain go1.99rc1$' |
| 56 |
grep 'go 1.23.9' go.mod |
| 57 |
grep 'toolchain go1.99rc1' go.mod |
| 58 |
|
| 59 |
# go get toolchain should find go1.999testmod. |
| 60 |
go get toolchain |
| 61 |
stderr '^go: upgraded toolchain go1.99rc1 => go1.999testmod$' |
| 62 |
grep 'go 1.23.9' go.mod |
| 63 |
grep 'toolchain go1.999testmod' go.mod |
| 64 |
|
| 65 |
# go get [email protected] should use the latest Go 1.23 |
| 66 |
go get [email protected] |
| 67 |
stderr '^go: removed toolchain go1.999testmod$' |
| 68 |
grep 'go 1.23.9' go.mod |
| 69 |
! grep 'toolchain go1.23.9' go.mod # implied |
| 70 |
|
| 71 |
# go get [email protected] should use the latest Go 1.22 and downgrade go. |
| 72 |
go get [email protected] |
| 73 |
stderr '^go: downgraded go 1.23.9 => 1.22.9$' |
| 74 |
grep 'go 1.22.9' go.mod |
| 75 |
! grep 'toolchain go1.22.9' go.mod # implied |
| 76 |
|
| 77 |
# go get toolchain@patch should use the latest patch release |
| 78 |
go get [email protected] |
| 79 |
go get toolchain@patch |
| 80 |
stderr '^go: added toolchain go1.22.9$' |
| 81 |
grep 'go 1.22.1' go.mod |
| 82 |
grep 'toolchain go1.22.9' go.mod |
| 83 |
go get [email protected] toolchain@none |
| 84 |
grep 'go 1.22.9' go.mod |
| 85 |
! grep 'toolchain go1.22.9' go.mod |
| 86 |
|
| 87 |
# go get [email protected] does NOT find the release candidate |
| 88 |
! go get [email protected] |
| 89 |
stderr '^go: [email protected]: no matching versions for query "go1.24"$' |
| 90 |
|
| 91 |
# go get [email protected] works |
| 92 |
go get [email protected] |
| 93 |
stderr '^go: added toolchain go1.24rc1$' |
| 94 |
grep 'go 1.22.9' go.mod # no longer implied |
| 95 |
grep 'toolchain go1.24rc1' go.mod |
| 96 |
|
| 97 |
# go get toolchain@latest finds go1.23.9. |
| 98 |
cp go.mod.orig go.mod |
| 99 |
go get toolchain@latest |
| 100 |
stderr '^go: added toolchain go1.23.9$' |
| 101 |
grep 'go 1.21' go.mod |
| 102 |
grep 'toolchain go1.23.9' go.mod |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
# Bug fixes. |
| 107 |
|
| 108 |
# go get go@garbage should fail but not crash |
| 109 |
! go get go@garbage |
| 110 |
! stderr panic |
| 111 |
stderr '^go: invalid go version garbage$' |
| 112 |
|
| 113 |
# go get [email protected] is OK - we silently correct to 1.21.0 |
| 114 |
go get [email protected] |
| 115 |
go get [email protected] |
| 116 |
stderr '^go: upgraded go 1.19 => 1.21.0' |
| 117 |
|
| 118 |
# go get [email protected] is OK too. |
| 119 |
go get [email protected] |
| 120 |
stderr '^go: upgraded toolchain go1.23.9 => go1.24rc1$' |
| 121 |
|
| 122 |
# go get [email protected] should work if we are the Go 1.21 language version, |
| 123 |
# even though there's no toolchain for it. |
| 124 |
# (Older versions resolve to the latest release in that version, so for example |
| 125 |
# go get [email protected] might resolve to 1.20.9, but if we're the devel copy of |
| 126 |
# Go 1.21, there's no release yet to resolve to, so we resolve to ourselves.) |
| 127 |
env TESTGO_VERSION=go1.21 |
| 128 |
go get [email protected] toolchain@none |
| 129 |
go get [email protected] |
| 130 |
grep 'go 1.21$' go.mod |
| 131 |
! grep toolchain go.mod |
| 132 |
|
| 133 |
-- go.mod.orig -- |
| 134 |
module m |
| 135 |
|
| 136 |
go 1.21 |