From 10420903910ce3fbae3596d0979e9db3468a51de Mon Sep 17 00:00:00 2001 From: Morgan Howard Date: Mon, 11 Oct 2021 20:07:26 -0700 Subject: [PATCH] go-fmt: add page (#6703) --- pages/common/go-fmt.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pages/common/go-fmt.md diff --git a/pages/common/go-fmt.md b/pages/common/go-fmt.md new file mode 100644 index 000000000..d65a7a92b --- /dev/null +++ b/pages/common/go-fmt.md @@ -0,0 +1,25 @@ +# go fmt + +> Format Go source files. +> Prints the filenames that are changed. +> More information: . + +- 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`