By Josh Bussdieker (jbuss, jaja, jbussdieker) while working at Moovweb
Currently lovingly maintained by Benjamin Knigge
Pull requests and other any other contributions would be very much appreciated.
GVM provides an interface to manage Go versions.
- Install/Uninstall Go versions with
gvm install [tag]where tag is "60.3", "go1", "weekly.2011-11-08", or "tip" - List added/removed files in GOROOT with
gvm diff - Manage GOPATHs with
gvm pkgset [create/use/delete] [name]. Use--localasnameto manage repository under local path (/path/to/repo/.gvm_local). - List latest release tags with
gvm listall. Use--allto list weekly as well. - Cache a clean copy of the latest Go source for multiple version installs.
- Link project directories into GOPATH
When we started developing in Go mismatched dependencies and API changes plagued our build process and made it extremely difficult to merge with other peoples changes.
After nuking my entire GOROOT several times and rebuilding I decided to come up with a tool to oversee the process. It eventually evolved into what gvm is today.
To install:
-
Install Bison:
sudo apt-get install bison -
Install gvm:
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
Or if you are using zsh just change bash with zsh
gvm install go1.4
gvm use go1.4 [--default]
Once this is done Go will be in the path and ready to use. $GOROOT and $GOPATH are set automatically.
Additional options can be specified when installing Go:
Usage: gvm install [version] [options]
-s, --source=SOURCE Install Go from specified source.
-n, --name=NAME Override the default name for this version.
-pb, --with-protobuf Install Go protocol buffers.
-b, --with-build-tools Install package build tools.
-B, --binary Only install from binary.
--prefer-binary Attempt a binary install, falling back to source.
-h, --help Display this message.
Go 1.5+ removed the C compilers from the toolchain and replaced them with one written in Go. Obviously, this creates a bootstrapping problem if you don't already have a working Go install. In order to compile Go 1.5+, make sure Go 1.4 is installed first. If Go 1.4 won't install try a later version (e.g. go1.5), just make sure you have the -B option after the version number.
gvm install go1.4 -B
gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT
gvm install go1.7
Binary versions for ARMv6 architecture are available starting from Go 1.6. So, it is necessary to bootstrap with an existing binary version, then it will be possible compiling other versions. For instance, to bootstrap a setup, version 1.21.0 may be used:
gvm install go1.21.0 -B
gvm use go1.21.0