#development #golang

When you want to test out the latest development version of Go, the developers of Go created a nice command to get it installed and to keep it updated. The command is called gotip and is of course written in Go.

To install it, it's just a plain Go binary you can install:

$ go get golang.org/dl/gotip

After you downloaded the binary, you need to compile/download the latest version of Go:

$ gotip download
Cloning into '/Users/pclaerhout/sdk/gotip'...
remote: Counting objects: 9883, done
remote: Finding sources: 100% (9883/9883)
remote: Total 9883 (delta 1330), reused 6560 (delta 1330)
Receiving objects: 100% (9883/9883), 23.58 MiB | 10.57 MiB/s, done.
Resolving deltas: 100% (1330/1330), done.
Updating files: 100% (9074/9074), done.
Updating the go development tree...
From https://go.googlesource.com/go
 * branch            master     -> FETCH_HEAD
HEAD is now at 53f2747 syscall, internal/syscall/windows: remove utf16PtrToString parameter
Building Go cmd/dist using /usr/local/Cellar/go/1.14.2/libexec. (go1.14.2 darwin/amd64)
Building Go toolchain1 using /usr/local/Cellar/go/1.14.2/libexec.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for darwin/amd64.
---
Installed Go for darwin/amd64 in /Users/pclaerhout/sdk/gotip
Installed commands in /Users/pclaerhout/sdk/gotip/bin
Success. You may now run 'gotip'!

That's all. If you now want to run with the latest Go version, replace your regular go command with gotip.

To build with the latest released version:

$ go build main.go

To build with the development version:

$ gotip build main.go

If you want to update gotip to the latest dev version, you execute gotip download again…