There are 3 tools/tricks which are pretty essential to writing Go code on a team or open source project which I highly recommend:
-
Set up your editor to automatically run the code through
goimports
once you hit save.It's extremely fast. It formats your code using the standard
gofmt
tool. It automatically adds/removes/organizes your import lines. Note that Go uses tabs, so I recommend setting your editor's tab-width to 2 or 4, whichever you're used to. Anything but 8. Editor support: