mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-14 04:59:33 +00:00
Update cheatsheets
This commit is contained in:
25
gofmt
Normal file
25
gofmt
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# 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}}`
|
||||
Reference in New Issue
Block a user