From 5054170ce7cf8ef9c25ce45dc7db09981811beaa Mon Sep 17 00:00:00 2001 From: Nalin Bhardwaj Date: Sat, 2 Dec 2017 13:56:20 +0530 Subject: [PATCH] gofmt: add page (#1730) --- pages/common/gofmt.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pages/common/gofmt.md diff --git a/pages/common/gofmt.md b/pages/common/gofmt.md new file mode 100644 index 0000000000..7c7dadafc8 --- /dev/null +++ b/pages/common/gofmt.md @@ -0,0 +1,19 @@ +# 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}}`