Essential Go Getting started  Edit on GitHub      File Issue

Linux setup

After installing the compiler you need to configure GOPATH environment variable.

Since Go 1.8, the GOPATH environment variable has the default value of $HOME/go, so you can skip setting it.

Create the go directory with mkdir $HOME/go.

Add the following two lines at the end of your ~/.bashrc file

export GOPATH=$HOME/go
export PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
$ source ~/.bashrc

Test the setup by running go version.

You should understand the effect of GOPATH.

  ↑ ↓ to navigate     ↵ to select     Esc to close