Install Go

Getting set up with Go is surprisingly easy. While these instructions cover linux (specifically Fedora), the steps are generally the same across operating systems.

Setting up Golang

On Fedora 25, Go can be installed using the native DNF package manager:

> sudo dnf install go

When complete, verify the version at a Terminal with:

> go version
> go version go1.7.4 linux/amd64

Go environment variables

Go works best with a couple environment variables set. Use a text editor to open ~/.bashrc and add:

GOPATH=/home/acuga/Code/go-work
export GOPATH
export PATH=$PATH:$GOPATH/bin

This tells Go where to find all code and lets compiled binaries be run anywhere on the system.

Verify the variables are set by opening a new Terminal (or source ~/.bashrc):

> go env | grep GOPATH
GOPATH="/home/acuga/Code/go-work"

Congrats! That’s all that’s necessary to get set up with Go!

Other operating systems

Go has a more thourough suite of installation options on their site at the Official Go Installation instructions, including Windows, macOS, FreeBSD, etc.

Many Happy Returns   ▶