Installing golang with gvm and zsh


add this to your rc file

[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"

###The Details:

There is a wonderful tool to install and otherwise manage go versions gvm. It is very similar to nvm (node version manager)

To install gvm run:

$ bash < <(curl -s

if you are using zsh and ohmyzsh in particular, you need to add this to your rc file

[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"

Then it is easy to install and use any version of go.

to list available go versions:

gvm listall

to install just use:

gvm install go1.4.2  

currently most recent stable version of go.

You will get something like that:

➜  ~  gvm install go1.4.2
Downloading Go source...
Installing go1.4.2...
 * Compiling...
➜  ~

to make it a default use this commands:

gvm use go1.4.2 --default

After running go use command you will have the $GOROOT added and the $PATH updated.

Go will reside in ~/.gvm/gos/go1.4.2 or a similar folder, depending on the version(s) you have installed.

Kudos to the author for making our lives easier!