Skip to content
masterclass Buddy

Go · Command

go fmt

go fmt formats Go package source files by running gofmt. It writes the formatted files and reports which files changed.

Last updated

Syntax

go fmt [-n] [-x] [packages]

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • gofmt
  • go vet
  • go fix
  • go tool

Source: Command Documentation - The Go Programming Language. Checked 2026-11-03.