Go
Go builds the services, libraries and CLI. Any Go from 1.21 on works: it downloads the newer toolchain a repository asks for.
Install
Skip to Configure if this prints go1.21 or newer:
bash
go versionThe distribution's Go lags behind; install the official build:
bash
GO_VERSION=$(curl -fsSL "https://go.dev/VERSION?m=text" | head -n 1)
GO_ARCH=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')
curl -fsSLo /tmp/go.tar.gz "https://go.dev/dl/$GO_VERSION.linux-$GO_ARCH.tar.gz"
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf /tmp/go.tar.gz
echo 'export PATH="$PATH:/usr/local/go/bin"' >> "$HOME/.$(basename "$SHELL")rc"
exec "$SHELL"To upgrade, run the first four lines again.
Configure
Allow toolchain downloads
Skip if this prints auto:
bash
go env GOTOOLCHAINOtherwise, your distribution turned downloads off. Turn them back on:
bash
go env -w GOTOOLCHAIN=autoPut Go programs on your PATH
The CLI installs into Go's program directory, ~/go/bin unless you moved it. Skip if echo "$PATH" lists it already.
bash
GO_BIN="$(go env GOPATH)/bin"
printf 'export PATH="$PATH:%s"\n' "$GO_BIN" >> "$HOME/.$(basename "$SHELL")rc"
exec "$SHELL"The rc stores the path itself, so a new shell starts no Go command. An rc line that calls go env GOPATH still works but starts Go in every new shell. Replace it with the one this block writes.