Last Updated: February 25, 2016
·
591
· hoffoo

Manage Go versions with GVM

I ran into a package recently that required go1.3, and ive been running 1.2.1 for ages.

Naturally instead of upgrading I thought this was a good reason to try out gvm. Its a collection of shell scripts to manage different version of go and their collective dependencies. You can easily switch between versions of go, either to migrate your code or even try it on older version.

The tool inserts a line in your .bashrc, so its easy to disable if you want to go back to your original install. It also supports installing from source or binary.

~$ go version
go version go1.2.1 linux/amd64
~$ gvm install 1.3 -B                   # install binary go, omit -B to build from source
~$ gvm use 1.3
Now using version 1.3
~$ go version
go version 1.3 linux/amd64       # new go

Now you can use the usual way of installing packages and running 1.3 code into this
new environment.