Format
Rewrites your Go with gofmt, the official Go formatter. It fixes indentation, alignment, and spacing to match the one standard Go style.
func main(){fmt.Println(1)}Afterfunc main() {
fmt.Println(1)
}Paste your Go and get it back in the one standard Go style. The formatter is gofmt, the same tool that ships with Go, running in your browser, so your code stays on your device.
Format uses gofmt, the official Go formatter (tabs, no options).
Go has one official style, and gofmt is the tool that applies it. It fixes indentation, aligns struct fields and comments, and tidies spacing so every Go file looks the same. Because the style is fixed, there is nothing to configure. This tool runs gofmt in your browser and changes only the layout, never what the program does.
Rewrites your Go with gofmt, the official Go formatter. It fixes indentation, alignment, and spacing to match the one standard Go style.
func main(){fmt.Println(1)}Afterfunc main() {
fmt.Println(1)
}gofmt has no options on purpose. Every Go project uses the same layout, so there is nothing to configure. It always uses tabs for indentation.
Many personal stylesAfterOne shared Go stylegofmt indents with tabs, which is the Go standard. Your editor can then show tabs at whatever width you prefer without changing the file.
Mixed spaces and tabsAfterTabs, the Go waygofmt helps whenever you have Go code that is not yet in the standard style. These are the cases that come up most:
Once your Go is formatted, these official references explain the language and the formatter behind this tool:
If you work across languages, these formatters run the same way, right in your browser: