Preparing the tool

Installing the Go compiler and making it ready to use is sometimes tricky. However, Golang Version Manager (GVM), is a tool that helps with installing and uninstalling different Go versions on the same machine. It also helps manage GOPATH effectively.

What is GOPATH? It is defined as follows in Wikipedia:

"The GOPATH environment variable is used to specify directories outside of $GOROOT that contain the source for Go projects and their binaries."

To start using GVM, we first install the gvm command using the snippet provided on https://github.com/moovweb/gvm. It can be installed with a single command:

$ bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

Now we have GVM installed already, and we continue by installing Go.

It is great to use Go's most recent version-1.9.3. The command to install is, of course, gvm install. We pass the -B parameter to the install command, so that it will download and use only the binary of the Go distribution:

$ gvm install go1.9.3 -B
Installing go1.9.3 from binary source

Next, if we choose to go with Go v1.9.3 when taking care of our cluster, we should make it the default version. Issue the gvm use command with the --default parameter to do so:

$ gvm use go1.9.3 --default
Now using version go1.9.3
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset