The Go ecosystem lacks a standard way to check whether a system is running the latest revision of the current {major}.{minor} version of Go available.
https://go.dev/dl/?mode=json already provides a machine-readable (JSON) list of all the currently supported versions, but integrating it into a toolchain often requires complex scripts with external dependencies (e.g. curl, jq).
It seems like something the go command should handle in a consistent way.
My proposal is to extend go version with a new check command as following:
With no parameters, it would check whether the system is running the latest revision of the current major version installed.
> go version check
Running the latest revision of Go 1.20 (go1.20.3 darwin/arm64).
(code 0)
With a --latest flag, it would check whether the system is running the latest major release of Go.
> go version check --latest
Go 1.20 is available → https://tip.golang.org/doc/go1.20
(code 1)
Ideally, this would also serve warnings for out-of-support versions:
> go version check
Go 1.18 is no longer supported (go1.18.10 darwin/arm64).
(code 1)
The text was updated successfully, but these errors were encountered:
@thediveo It would scripts calling go version against a binary named check, but there are workarounds for that (go check?). Not really opinionated about the syntax.
@mvdan Thanks, helpful context. I'd personally be opposed to making go version install anything on my system.
The Go ecosystem lacks a standard way to check whether a system is running the latest revision of the current
{major}.{minor}
version of Go available.https://go.dev/dl/?mode=json already provides a machine-readable (JSON) list of all the currently supported versions, but integrating it into a toolchain often requires complex scripts with external dependencies (e.g. curl, jq).
It seems like something the
go
command should handle in a consistent way.My proposal is to extend
go version
with a newcheck
command as following:With no parameters, it would check whether the system is running the latest revision of the current major version installed.
> go version check Running the latest revision of Go 1.20 (go1.20.3 darwin/arm64). (code 0)
With a
--latest
flag, it would check whether the system is running the latest major release of Go.> go version check --latest Go 1.20 is available → https://tip.golang.org/doc/go1.20 (code 1)
Ideally, this would also serve warnings for out-of-support versions:
> go version check Go 1.18 is no longer supported (go1.18.10 darwin/arm64). (code 1)
The text was updated successfully, but these errors were encountered: