gofmt

Gofmt formats Go programs.

Without an explicit path, it processes the standard input. Given a file, it operates on that file; given a directory, it operates on all .go files in that directory, recursively. (Files starting with a period are ignored.)

Usage:

gofmt [flags] [path ...] 

Compile a go program