Go tools
An early decision made by the Go core team was that all Go code should look familiar and obvious to everybody who speaks Go rather than each code base requiring additional learning in order for new programmers to understand it or work on it. This is an especially sensible approach when you consider open source projects, some of which have hundreds of contributors coming and going all the time.
There is a range of tools that can assist us in achieving the high standards set by the Go core team, and we will look at some of the tools in action in this section.
In your GOPATH
location, create a new folder called tooling
and create a new main.go
file containing the following code verbatim:
package main import ( "fmt" ) func main() { return var name string name = "Mat" fmt.Println("Hello ", name) }
The tight spaces and lack of indentation are deliberate as we are going to look at a very cool utility that comes with Go.
In a terminal, navigate...