Format Go code online with gofmt-style rules. Corrects := short assignments, [] slice types, and <- channel operators. Configurable indent. Browser-based.
The Go Formatter is a browser-based tool that instantly formats Go source code with gofmt-style conventions. Because no WebAssembly port of gofmt is available for browser environments, the tool uses js-beautify with a Go-specific post-processor that correctly restores `:=` short variable declarations, `[]type` slice and array types, `<-` channel send operations, and `(<-chan)` channel receive expressions in function calls — common sources of incorrect output from generic JavaScript beautifiers. Configurable indentation and up to 2 preserved blank lines produce readable, consistently structured Go. All processing runs in a Web Worker; your code never leaves the browser.
QIs this the same as running gofmt?
The output approximates gofmt conventions. Because no WebAssembly port of gofmt is available in browsers, the tool uses js-beautify with Go-specific post-processing to handle the most common Go syntax patterns. For exact gofmt output, use the Go CLI locally.
QWhy use tab indentation for Go?
gofmt defaults to tab indentation — it is the official Go style. The tool's indentation picker defaults to tab and allows switching to 2 or 4 spaces for preview purposes.
QDoes it support goroutines and channels?
Yes — the post-processor specifically handles channel send (`ch <- val`) and receive (`<-ch`) operators, which js-beautify would otherwise corrupt.
QIs my code sent to a server?
No. All formatting runs locally in a Web Worker inside your browser. Nothing is transmitted to any server.