Go - Formatting

1 - About

The Go source script has a standard format defined by the Go team. Why ? Because :

  • it eliminates a lot of pointless debate about trivia
  • and, more importantly, enables a variety of automated source code transformations that would be infeasible if arbitrary formatting were allowed.

3 - Tools

  • Many text editors can be configured to run gofmt each time you save a file
  • goimports additionally manages the insertion and removal of import declarations as needed. (available at go get golang.org/x/tools/cmd/goimports)

4 - Documentation / Reference

lang/go/format.txt ยท Last modified: 2017/03/05 17:07 by gerardnico