Update 01/24/16: I thought this may be useful enough, that I decided to submit it to the core language-go package with this pull request. It was merged, so this should be available by default in future releases.

This is going be a super quick post, but I thought I’d throw it out there for any Atom newcomers who might need a snippet for creating a quick little starter template for their Go packages/scripts.

First things first, make sure the core language-go package is enabled. It should be by default.

Next, select “Open Your Snippets” from the “Atom” menu item (on OS X…not sure where it lives on Windows).

In the file that opens, snippets.cson, paste the following code:

After that’s in place, open up a .go file. When you start typing got into the file, you should see your new snippet in the autocomplete menu!

Start typing, and you’ll see that the package and main function declarations change at the same time. Tab around and get a feel for the template.

Feel free to change the name “go template” and the “prefix” to whatever makes sense for you.