Skip to content

Instantly share code, notes, and snippets.

@nikhita
Last active March 16, 2026 20:53
Show Gist options
  • Select an option

  • Save nikhita/432436d570b89cab172dcf2894465753 to your computer and use it in GitHub Desktop.

Select an option

Save nikhita/432436d570b89cab172dcf2894465753 to your computer and use it in GitHub Desktop.
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

$ sudo rm -rf /usr/local/go

2. Install the new version

Go to the downloads page and download the binary release suitable for your system.

3. Extract the archive file

To extract the archive file:

$ sudo tar -C /usr/local -xzf /home/nikhita/Downloads/go1.8.1.linux-amd64.tar.gz

4. Make sure that your PATH contains /usr/local/go/bin

$ echo $PATH | grep "/usr/local/go/bin"
@dxps

dxps commented Jul 19, 2025

Copy link
Copy Markdown

@ggcr Unfortunately, it doesn't work globally (outside of a project/module):

~ ❯ go get go@1.24.5
go: go.mod file not found in current directory or any parent directory.
	'go get' is no longer supported outside a module.
	To build and install a command, use 'go install' with a version,
	like 'go install example.com/cmd@latest'
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.
~

@theepicsaxguy

theepicsaxguy commented Sep 3, 2025

Copy link
Copy Markdown

This can be a alternative.

wget -qO- https://raw.githubusercontent.com/DieTime/go-up/master/go-up.sh | bash

This will detect your current install, fetch the latest release from go.dev/dl, and replace /usr/local/go with it.

@RobotWiz

Copy link
Copy Markdown

Why does none of this use package managers

@u3088943975-debug

Copy link
Copy Markdown

git clone https://github.com/udhos/update-golang cd update-golang sudo ./update-golang.sh

These "little scripts to make upgrading easier" go 1.21 -> go 1.25 , GitHub CLI, brought desktop penguin's 24.4.3 into room-full neon pink balloons.
If the content refers to specific versions of obsolete or harmful changes, or deprecated clusters too , please report it and resolve any conflicts.

@pankajAtNetApp

Copy link
Copy Markdown

This can be a alternative.

wget -qO- https://raw.githubusercontent.com/DieTime/go-up/master/go-up.sh | bash

This will detect your current install, fetch the latest release from go.dev/dl, and replace /usr/local/go with it.

This works for me, thank you

I do install golang using

sudo apt install golang

And after that I ran that command

@nikhiljohn10

Copy link
Copy Markdown

If you installed go using steps in Offical Go docs, try the following go tool to self update to any version on the go. If you don't have go, you can get it as binary from Release section. I made if for myself since i cant find a go based self updation tool. So if anyone want go updation tool written in purely Go, try goupdate tool.

go install github.com/goozt/goupdate@latest

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