Golang: Format Source Code
The command line tool gofmt
, bundled with golang,
reformat your go source code to a standard format.
Run it in terminal like this:
gofmt fileName
For example
before:
package main; import "fmt"; func main() { var x = "John"; var y = 36; fmt.Printf("name is %v, age is %v\n", x, y); }
After:
package main import "fmt" func main() { var x = "John" var y = 36 fmt.Printf("name is %v, age is %v\n", x, y) }