
~/GO and PATH in /etc/profile. That was in 2019. Below: the official tarball from go.dev (Go 1.27 series, released in August 2026), snap, and apt — with go.mod, without a manually configured GOPATH.Go was born at Google in 2007 (Pike, Thompson, Griesemer) and became open source in 2009 — we tell that story in The history of the Go language. It compiles quickly, produces a binary, and provides concurrency with goroutines. Docker, Kubernetes, Terraform: Go. In 2019 this how-to downloaded a script. In 2026 the official path is the tarball from go.dev/dl.
Official tarball (recommended)
Fetches the current stable version, checks the architecture, and installs into /usr/local/go. Do not extract over an old tree — Go itself asks you to delete it first:
VER=$(curl -fsSL 'https://go.dev/VERSION?m=text' | head -n1)
case $(uname -m) in
x86_64) GOARCH=amd64 ;;
aarch64) GOARCH=arm64 ;;
*) echo "arch não suportada"; exit 1 ;;
esac
cd /tmp
curl -fLO "https://go.dev/dl/${VER}.linux-${GOARCH}.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "${VER}.linux-${GOARCH}.tar.gz"
Set PATH for your user, not in /etc/profile for root:
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.profile
source ~/.profile
go version
The default GOPATH is already ~/go. You do not need mkdir ~/GO. The SHA-256 checksum for each file is at go.dev/dl. Starting with 1.21, the toolchain can download a newer version automatically if the go.mod requests it (GOTOOLCHAIN).
Snap and apt
If you want the distro package, be aware that it lags behind upstream. Ubuntu 24.04 packages around 1.22; Canonical's snap keeps up better:
# snap (clássico, atualiza sozinho)
sudo snap install go --classic
go version
# apt (estável da distro, costuma ser mais velho)
sudo apt update
sudo apt install -y golang-go git
go version
Do not mix snap, apt, and /usr/local/go in the same PATH. Choose one. The PPA longsleep/golang-backports still exists for Ubuntu LTS if the machine's apt version is too old.
Hello, module
Since 1.16, modules are the default. No more GOPATH/src/github.com/...:
mkdir -p ~/src/hello && cd ~/src/hello
go mod init hello
printf 'package mainnimport "fmt"nfunc main() { fmt.Println("olá, linuxpro") }n' > hello.go
go run .
Generics have existed since 1.18 — the 2019 text said there were none. The gist from the original post (jniltinho/8758e15a9ef80a189fce) remains a relic: do not run gist scripts as root in 2026.
Wrap-up
One tarball, one PATH, one go mod init. The language that the 2017 list still called “weak in Brazil” is now the language of infrastructure. The overview: The 7 main programming languages. The 2017 how-to, this one's older sibling: Installing Golang on Linux.
With Go installed, see the language in action here on the blog — two of our projects written in Go: go-imapsync (IMAP mailbox migration in a single binary) and go-postfixadmin (a modern panel for Postfix).
Docs: go.dev/doc/install · tour: go.dev/tour.