New Way:
Note: Not for trying out a go application / binaries on your host machine using go install [repo url]
, in such cases you still have to use the old way.
Old Way:
Just add the following lines to ~/.bashrc
and this will persist. However, you can use other paths you like as GOPATH instead of $HOME/go
in my sample.
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin