Closed jezek closed 9 months ago
The version
tool currently has a very narrow scope: it just shows the version of the toolchain it's invoked from. I think it's unlikely it'll be expanded to become an installer.
OTOH, we already have a tool called getgo
(https://github.com/golang/tools/tree/master/cmd/getgo) that can be used to install go toolchains. Note that (from its docs):
If Go is already installed via this installer it will upgrade it to the latest version of Go.
which is similar to what you're asking.
Thank you for the getgo
command, I should have searched harder.
But IMHO this command should be installed by default like gofmt
or godoc
. Or am I wrong?
go version -update is definitely too difficult. (The go command should not be attempting to overwrite itself.) Changing to a proposal to document and ship getgo.
/cc @andybons for triage. If no one is available now maybe put on hold.
Shipping getgo
is a great idea. From what I see in HN, the community will definitely benefit from this. But there are some pending issues which need attention - https://github.com/golang/go/issues/21277, https://github.com/golang/go/issues/21533.
Also, note that if one already has a go distribution, it is possible to do go get golang.org/dl/<>
to install/update go. Although, it will install in $HOME/sdk and not in /usr/local/go
. But ideally, we should promote and use only one tool for installing/updating go.
Putting on hold for now while we figure out next steps so that proposal committee doesn’t need to see it each week.
I'll chime in here with a suggestion for standardisation with other programming languages: go upgrade
Via https://github.com/golang/go/issues/53596 for inline visibility:
A number of the programming languages I use support upgrade paths built into their tooling which has made keeping up to date extremely easy. This is definitely more of a ✨nice to have✨ for developer experience.
Benefits
- Could make upgrades easier for newcomers.
- Could make it easier for developers to stay up to date.
- Could make polyglot device management easier for teams by the CLI being able to run the upgrade.
- Could help stop human polling of
go.dev
, twitter or rss release feeds to know when a new version is out.Prior Art
flutter upgrade
rustup upgrade
- Most JavaScript frameworks provide some form of the above, i.e.
ember update
but this is little different as these are libraries/frameworks than a language.Example
The following example pinched from the Flutter upgrade flow:
$ go upgrade upgrading from go1.18.2 to go1.18.3... Downloading Go SDK... Expanding downloaded archive... Upgrading Go... Go 1.18.3 • channel stable • https://github.com/golang/go.git revision 4068be5 (28 days ago) • 2022-06-02 04:38:00 +1200
$ go upgrade go is already up to date on channel stable go version go1.18.3 windows/amd64
fyi - getgo
is deprecated. #60951
Should we close this proposal?
I suspect it should go to Declined as Obsolete. Removed it from Hold so that this can happen.
This proposal is a duplicate of a previously discussed proposal, as noted above, and there is no significant new information to justify reopening the discussion. The issue has therefore been declined as a duplicate. — rsc for the proposal review group
Feature request:
Provide a go tool to update go to latest stable version, or to a user selected version.
Examples:
Update go to latest stable version.
Replace current version with version 1.x.y