Pocket Gophers

Trying Other Go Versions

While I generally use the current release of Go, sometimes I need to try a different version. For example, I need to check that all the examples in my Guide to JSON work with both the supported releases of Go(1.8.6 and 1.9.3 at time of writing) along with go1.10rc1.

I primarily use the current version of Go, updating it when new versions are released. I try out other versions as needed following the methods described in this article.

Trying Betas and Release Candidates

When go1.8beta2 was released, a new tool for trying the beta and release candidates was also released that allowed you to go get the beta. It allowed you to easily run the beta alongside your Go installation by getting the beta with:

go get golang.org/x/build/version/go1.8beta2

This downloads and builds a small program that will act like the go tool for that specific version. The full release can then be downloaded and installed with:

go1.8beta2 download

This downloads the release from https://golang.org/dl and installs it into $HOME/sdk or %USERPROFILE%\sdk.

Now you can use go1.8beta2 as if it were the normal Go command.

This method works for all the beta and release candidates released after go1.8beta2.

Trying a Specific Release

While only beta and release candidates are provided, they can easily be adapted to work with any released version. For example, to use go1.9.2:

package main

import (

func main() {

Replace go1.9.2 with the release you want to run and build/install as usual.

Since the program I use to build my Guide to JSON calls go itself (for each example), I build this as go and prepend the directory to my PATH so it will use this one instead of my normal version.

Trying Any Release

This small program can be extended so you can specify the release to use instead of having to maintain binaries for each version.

package main

import (


func main() {
	if len(os.Args) < 2 {
		fmt.Printf("USAGE: %v <version> [commands as normal]\n",

	v := os.Args[1]
	os.Args = append(os.Args[0:1], os.Args[2:]...)

	version.Run("go" + v)

I have this installed as gov and run it like gov 1.8.6 version, using the version I want to run.

Trying a Source Build (e.g., tip)

I also use this same infrastructure to manage source builds of Go, such as tip. There’s just a little trick to it:

(On Windows, replace $HOME/sdk with %USERPROFILE%\sdk)

Dig into the Fundamentals of Go

Subscribe to receive a weekly email covering a Go fundamental. Be it the language, its tooling, or its packages, you will learn what you need to know.