mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-23 21:22:09 +02:00

Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
20 lines
424 B
Markdown
20 lines
424 B
Markdown
# gofmt
|
|
|
|
> Format Go source code.
|
|
> More information: <https://golang.org/cmd/gofmt/>.
|
|
|
|
- Format a file and display the result to the console:
|
|
|
|
`gofmt {{source.go}}`
|
|
|
|
- Format a file, overwriting the original file in-place:
|
|
|
|
`gofmt -w {{source.go}}`
|
|
|
|
- Format a file, and then simplify the code, overwriting the original file:
|
|
|
|
`gofmt -s -w {{source.go}}`
|
|
|
|
- Print all (including spurious) errors:
|
|
|
|
`gofmt -e {{source.go}}`
|