1. Install GO Development Environment
1.1. By package manager
Install Go by dnf:
$ sudo dnf install go-toolset
Install Go by apt:
$ sudo apt install -y golang
Show the version:
$ go version
go version go1.18.1 linux/amd64
The packaged version is quite old, so it is not recommended.
1.2. By release tar balls/pkgs
Donwload and install Go manually:
$ curl -LO https://go.dev/dl/go1.24.2.linux-amd64.tar.gz
$ sudo rm -rf /usr/local/go
$ sudo tar -C /usr/local -xzf go1.24.2.linux-amd64.tar.gz
$ echo "PATH=\"/usr/local/go/bin:\${PATH}\"" | sudo tee /etc/profile.d/go.sh
Open a new console:
$ go version
go version go1.24.2 linux/amd64
For Intel silicon:
$ curl -LO https://go.dev/dl/go1.24.4.darwin-amd64.pkg
$ open go1.24.4.darwin-amd64.pkg
Open a new console:
$ go version
go version go1.24.4 darwin/amd64
For Apple silicon:
$ curl -LO https://dl.google.com/go/go1.26.3.darwin-arm64.pkg
$ open go1.26.3.darwin-arm64.pkg
Open a new console:
$ go version
go version go1.26.3 darwin/arm64
$ which go
/usr/local/go/bin/go
$ go env GOPATH
/Users/xxxx/go