Go includes a tool called gofmt that automatically formats your code. Run gofmt -w main.go to format a file in place. The -w flag writes changes back to the file.
Every Go developer uses gofmt. This means all Go code looks the same regardless of who wrote it. There's no arguing about tabs versus spaces or where to put braces. The tool decides, and everyone follows.