3.2. Formatting code
You can use the gofmt formatting tool to format code in a given path. When the path leads to a single file, the changes apply only to the file. When the path leads to a directory, all .go files in the directory are processed.
Procedure
To format your code in a given path, enter:
$ gofmt -w <code_path>Replace
<code_path>with the path to the code you want to format.참고To print the formatted code to standard output instead of writing it to the original file, omit the
-woption.