mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-09-10 17:33:38 +02:00
go-fmt: add page (#6703)
This commit is contained in:
parent
376a838eab
commit
1042090391
1 changed files with 25 additions and 0 deletions
25
pages/common/go-fmt.md
Normal file
25
pages/common/go-fmt.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# go fmt
|
||||
|
||||
> Format Go source files.
|
||||
> Prints the filenames that are changed.
|
||||
> More information: <https://pkg.go.dev/cmd/go#hdr-Gofmt__reformat__package_sources>.
|
||||
|
||||
- Format Go source files in the current directory:
|
||||
|
||||
`go fmt`
|
||||
|
||||
- Format a specific Go package in your import path (`$GOPATH/src`):
|
||||
|
||||
`go fmt {{path/to/package}}`
|
||||
|
||||
- Format the package in the current directory and all subdirectories (note the `...`):
|
||||
|
||||
`go fmt {{./...}}`
|
||||
|
||||
- Print what format commands would've been run, without modifying anything:
|
||||
|
||||
`go fmt -n`
|
||||
|
||||
- Print which format commands are run as they are run:
|
||||
|
||||
`go fmt -x`
|
Loading…
Add table
Reference in a new issue