Go fmt

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

The fmt ("format") command formats source code files, by applying a predetermined layout to Go source code. The program

go fmt delegates to gofmt, and it is equivalent to:

gofmt -l -w <file>

One counterintuitive fact is that it uses the tab character for indentation. This is uncommon.

Rob Pike: "gofmt style is no one's favorite, yet gofmt is everyone's favorite".