Skip to content

Go (golang)

Install Go on Linux

Install

Check latest version on GoLang and change it if you want latest. Here, the Go version is 1.23.1.

You have to know CPU architecture, you can check it with this command:

sh
uname -m
  • x86_64 is AMD
  • aarch64 is ARM
  • arm64 is ARM
sh
x86_64 # In this case, it's AMD
output

You can have another architecture, check it on GoLang website.

sh
wget -c https://golang.org/dl/go1.23.1.linux-amd64.tar.gz -O go.tar.gz
sh
wget -c https://golang.org/dl/go1.23.1.linux-arm64.tar.gz -O go.tar.gz

Delete old Go installation and extract new one.

sh
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go.tar.gz

Add to PATH

If you haven't ZSH, you can use ~/.bashrc instead of ~/.zshrc.

sh
vim ~/.zshrc
sh
export PATH=$PATH:/usr/local/go/bin
export GOPATH="$HOME/go"
PATH="$GOPATH/bin:$PATH"
sh
source ~/.zshrc

Now you can delete Go archive.

sh
rm go.tar.gz

Version

You can check Go version with go version command.

sh
go version

Update

Download new version of Go.

sh
wget -c https://golang.org/dl/go1.23.1.linux-amd64.tar.gz -O go.tar.gz

Delete old Go installation and extract new one.

sh
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go.tar.gz

MIT License