OS Manuals

/usr/bin/gofmt

the Go programming language

From go-1.24 1.24.13-r4 (enterprise-packages), captured 2026-11-08 by running gofmt --help (exit 0). permalink

usage: gofmt [flags] [path ...]
  -cpuprofile string
    	write cpu profile to this file
  -d	display diffs instead of rewriting files
  -e	report all errors (not just the first 10 on different lines)
  -l	list files whose formatting differs from gofmt's
  -r string
    	rewrite rule (e.g., 'a[b:len(a)] -> a[b:]')
  -s	simplify code
  -w	write result to (source) file instead of stdout
Options (7)
OptionDescriptionSource
-cpuprofile stringwrite cpu profile to this filehelp
-ddisplay diffs instead of rewriting fileshelp
-ereport all errors (not just the first 10 on different lines)help
-llist files whose formatting differs from gofmt'shelp
-r stringrewrite rule (e.g., 'a[b:len(a)] -> a[b:]')help
-ssimplify codehelp
-wwrite result to (source) file instead of stdouthelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.