mirror of https://github.com/CrimsonTome/tldr.git
20 lines
384 B
Markdown
20 lines
384 B
Markdown
|
# gofmt
|
||
|
|
||
|
> Tool for formatting Go source code.
|
||
|
|
||
|
- 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}}`
|