Go fmt

From NovaOrdis Knowledge Base
Revision as of 23:14, 2 July 2024 by Ovidiu (talk | contribs) (Created page with "=External= * https://pkg.go.dev/cmd/gofmt =Internal= * go Tool * Go Source Code Formatting =Overview= The <code>fmt</code> ("format") command formats source code files, by applying a predetermined layout to Go source code. It delegates to <code>gofmt</code>, and it is equivalent to: <syntaxhighlight lang='bash'> gofmt -l -w <file> </syntaxhighlight> One counterintuitive fact is that it uses the tab charac...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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. It 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".