Installing Go

Introduction #

Installing Go is easy enough, especially if you are running on Mac or Linux.

The Golang installation page is your primary reference here.

Which version?

Go has a pretty good backwards compatibility story, which should allow you to always upgrade to the latest and greatest. This makes working with Go a joy, and you don’t have to fear upgrades.

Nevertheless, should you need to run a specific Go version, you can either use docker containers or install specific versions as outlined here: https://go.dev/doc/manage-install. Then, manage the GOPATH variable to point to the correct go binary.

Install with Mac #

Using Homebrew

1
 brew install go

Install with Linux, Windows, Other #

  1. Visit the official downloads page https://go.dev/dl/ and download the correct binary,
  2. then extract it to a directory of your choice, e.g. /usr/local/go.
  3. Lastly, ensure that the go binary can be found on the PATH variable.

Install using a Linux package manager #

Snap

1
 snap install go

Debian/Ubuntu

1
2
 apt-get update -y
 apt install golang-go

Summary #

After having installed the go binary, try typing go version to ensure the installation worked correctly and you have the expected version.

1
go version

You may also enjoy