1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-23 05:02:10 +02:00
tldr/pages/common/go-fmt.md
Lena c9775847b6
pages/*: use the imperative in descriptions (#12574)
* pages/*: use the imperative in descriptions

* go-fmt: put the description on one line
2024-04-18 09:34:00 +05:30

24 lines
582 B
Markdown

# go fmt
> Format Go source files, printing the changed filenames.
> 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`