Why isn't there a go update command?

I am new to Go and I wanted to know why isn’t there a command like go update to update the current version of the language to the latest version. What I found after my search is that each time you want to update the version of Go you have to do the same process manually (sometimes you remove the current version and install the newest version again).

I have a background in Rust, and in there is a simple command to update the version with just typing on your terminal:

rustup update

I really would like to know if there is a way to do the same thing in Go?

You can use a version manager like asdf-vm to manage your go versions.

So there’s no builtin solution since 2009? Why is that?

Slightly different but related. I wanted to update dlv.
I ended up doing:

~> go get -u github.com/go-delve/delve/cmd/dlv
~> find ~/go -type d -name delve
/home/marc/go/pkg/mod/cache/download/github.com/go-delve/delve
~> ll /home/marc/go/pkg/mod/cache/download/github.com/go-delve/delve/@v/v1.9.0.zip
-rw------- 1 marc marc 7409639 Jul 19 20:41 /home/marc/go/pkg/mod/cache/download/github.com/go-delve/delve/@v/v1.9.0.zip
~> mkdir /tmp/dlv
~> cd /tmp/dlv
dlv> unzip /home/marc/go/pkg/mod/cache/download/github.com/go-delve/delve/@v/v1.9.0.zip
dlv> find . -type d -name dlv
./github.com/go-delve/delve@v1.9.0/cmd/dlv
dlv> cd /tmp/dlv/github.com/go-delve/delve@v1.9.0/cmd/dlv/
dlv> go mod init dlv
dlv> go mod tidy
dlv> go build
dlv> mv ~/go/bin/dlv ~/go/bin/dlv.1.8.0
dlv> mv dlv ~/go/bin/dlv
dlv> cd ~
~> rm -rf /tmp/dlv
~> type dlv
dlv is hashed (/home/marc/go/bin/dlv)
~> dlv version
Delve Debugger
Version: 1.9.0
Build: $Id: 69310c2f438e492f892d6af22e8e62c8ea1e9d8d $

Did I miss something obvious?

Wasn’t there any proposal for this? This is a lot for a manual workaround. I think it’s better if they include an update command to their CLI

It’s not build in rust either. Rustup is an external version manager, coincidentally maintained by the same foundation. But it’s not part of the language or the language toolchain.

I know, but it’s battery included. You don’t need that hassle to manually install a newer Go version each time. when I installed Go 1.18 I had to do a lot of work including removing the current version manually using ‘rm’.

What I think it’s appropriate is to include this to the ecosystem, I think it’s better

As a polyglot I prefer a unified tool anyway a lot over having to use yet another version manager for each language.

Asdf and nix serve this purpose well. There is in my opinion no need to bind resources for yet another new shiny thing.

I agree though, that without a version manager the install, upgrade and uninstall stories are not nice. Proper DEB and RPM should be provided, if not timely updated repositories.

2 Likes

FWIW, I installed Go via Homebrew, which gives me effortless auto-updates since years.

1 Like

Yep - and if you’re on Windows, you can use chocolatey:

… and I use ARCH-derived flavors of Linux and Go is in the AUR:

https://archlinux.org/packages/community/x86_64/go/

I’ve never really cared much that Go doesn’t have a dedicated package manager for the Go binaries, since every OS I use has a package manager that bundles Go for me. I did some searching to see if anybody was creating proposals for this and found nothing, so I’m assuming it’s not on most people’s radar. That said, I could see how it would be useful for some people.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.