Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: cmd/go: enhance go version to check if running latest revision of Go #59523

mohamedattahri opened this issue Apr 10, 2023 · 5 comments


Copy link

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. 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 →
(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)
@gopherbot gopherbot added this to the Proposal milestone Apr 10, 2023
Copy link

doesn't this break lots of existing scripts, etc.?

Copy link

mvdan commented Apr 10, 2023

Also see #57001.

Copy link
Contributor Author

@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.

@ianlancetaylor ianlancetaylor added the GoCommand cmd/go label Apr 12, 2023
Copy link

CC @bcmills @matloob

Copy link
Contributor Author

FYI - Sharing some code I'm using today, and which could be adapted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Status: Incoming

No branches or pull requests

5 participants