Tested tool guide
Tested browser tools
Checked August 16, 2026
What Go Formatter (gofmt) does, with a checked example
Go source pasted into this formatter is rewritten to the canonical layout produced by gofmt: tabs for block indentation, conventional spaces around tokens, blank lines between major sections, and normalized alignment. It is intended for Go files whose syntax is already valid, and its result can be compared directly with code formatted by the standard Go toolchain. The common surprise is that gofmt is intentionally not configurable. There is no project-specific brace style, indentation width, or maximum line length to select. It also does not correct program logic or repair invalid syntax.
Worked example
A concrete input and expected output from the current implementation.
Input
package main
import "fmt"
func main() {
fmt.Println("hi")
} ->
Expected output
package main
import "fmt"
func main() {
fmt.Println("hi")
}
The formatter separates the package clause, import declaration, and function declaration with blank lines. It indents the function call with a tab and adds a final newline, while leaving the function header, call, and string value unchanged.