Go fmt
Jump to navigation
Jump to search
External
Internal
Overview
gofmt
is a program that operates at source file level.
go fmt
operates at package level rather than source file level. go fmt
delegates to gofmt
, and it is equivalent to:
gofmt -l -w <file>
The tool formats source code files, by applying a predetermined layout, which includes a standard style of indentation and vertical alignment, and retains and if necessary reformats comments. 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".