Files
garble/testdata/scripts/goversion.txt
Daniel Martí ff0bea73b5 all: drop support for Go 1.15.x (#265)
This mainly cleans up the few bits of code where we explicitly kept
support for Go 1.15.x. With v0.1.0 released, we can drop support now,
since the next v0.2.0 release will only support Go 1.16.x.

Also updates all modules, including test ones, to 'go 1.16'.

Note that the TOOLEXEC_IMPORTPATH refactor is not done here, despite all
the TODOs about doing so when we drop 1.15 support. This is because that
refactor needs to be done carefully and might have side effects, so it's
best to keep it to a separate commit.

Finally, update the deps.
2021-03-05 16:52:00 +01:00

68 lines
1.7 KiB
Plaintext

# We use a simple Go program to report many Go versions.
# The program also errors on any command other than "go version",
# which saves us having to rebuild main.go many times.
go build -o .bin/go$exe ./fakego
env PATH=${WORK}/.bin${:}${PATH}
# An empty go version.
env GO_VERSION=''
! garble build
stderr 'Can''t get Go version'
# An invalid devel string.
env GO_VERSION='go version devel someinvalidversion'
! garble build
stderr 'Can''t recognize devel build timestamp'
# An invalid devel date.
env GO_VERSION='go version devel +afb5fca Sun Sep 99 99:99:99 9999 +0000 linux/amd64'
! garble build
stderr 'Can''t recognize devel build timestamp: parsing time'
# We should error on a devel version that's too old.
env GO_VERSION='go version devel +afb5fca Sun Aug 07 00:00:00 2020 +0000 linux/amd64'
! garble build
stderr 'Go version.*Aug 07.*too old; please upgrade to Go 1.16.x or a newer devel version'
# A future devel timestamp should be fine.
env GO_VERSION='go version devel +afb5fca Sun Sep 13 07:54:42 2021 +0000 linux/amd64'
! garble build
stderr 'mocking the real build'
# We should error on a stable version that's too old.
env GO_VERSION='go version go1.14 windows/amd64'
! garble build
stderr 'Go version.*go1.14.*too old; please upgrade to Go 1.16.x'
! stderr 'or a newer devel version'
# We should accept a future stable version.
env GO_VERSION='go version go1.16.2 windows/amd64'
! garble build
stderr 'mocking the real build'
-- go.mod --
module test/main
go 1.16
-- main.go --
package main
func main() {}
-- fakego/main.go --
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) > 0 && os.Args[1] == "version" {
fmt.Println(os.Getenv("GO_VERSION"))
return
}
fmt.Fprintln(os.Stderr, "mocking the real build")
os.Exit(1)
}