Have Ubuntu 14.04 installed on the VM I use as a programming/testing environment.
Golang packages in Ubuntu 14.04 repo are a bit old:
1 2 3 4 5
In order to compile Go 1.5+, make sure Go 1.4 is installed first. 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 install 1.6.3:
1 2 3 4
gofmt, golint, govet
A handful of useful tools to keep the code neat and correct.
Gofmt formats Go programs. It uses tabs (width = 8) for indentation and blanks for alignment.
Without an explicit path, it processes the standard input. Given a file, it operates on that file; given a directory, it operates on all .go files in that directory, recursively. (Files starting with a period are ignored.) By default, gofmt prints the reformatted sources to standard output.
Gofmt comes with vanilla Golang so no installation required. Example usage:
Golint is a linter for Go source code.
Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string. Vet uses heuristics that do not guarantee all reports are genuine problems, but it can find error s not caught by the compilers. Comes out of box as well.