Setting Up Atom for Go
Jan 14, 2016
2 minute read

When working with Go, you’ll benefit greatly from having a good text editor. These days, there’s a lot to choose from besides the traditional vim and emacs. A great choice for a free, open source editor is Atom because it’s highly extensible and has a ton of plugins (packages in Atom parlance) that make the experience even better.

For Go support, there’s a great package called go-plus that integrates several command line tools into the editor. On a fresh install of Atom and Go, you’ll need to install a few things via commmand line.

Requirements

  • Go (tested with 1.5.2)
  • Atom (tested with 1.4.0)

Additionally, you may need to have the GOPATH environment variable set and possibly even GOROOT. Experienced Go programmers will be familiar with GOPATH, but for the non-initiated it is a variable that points to where the non-core GO code is kept. It’s the location where packages from github are downloaded to and it’s where you can keep your own codebase as well.

Install Dependencies

Before installing the go-plus package, you may as well install the following command line tools:

  • goimports: updates your Go import lines, adding missing ones and removing unreferenced ones
  • oracle: a source analysis tool that answers questions about Go programs
  • golint: a linter for Go source code
  • godef: finds symbol information in Go source
  • gocode: An autocompletion daemon for the Go programming language

This can be done with the following go get commands:

go get golang.org/x/tools/cmd/goimports
go get golang.org/x/tools/cmd/oracle
go get github.com/golang/lint/golint
go get github.com/rogpeppe/godef
go get github.com/nsf/gocode

Install go-plus

The last step is to install go-plus from Atom.

  1. Open File | Settings from the menu.
  2. Select Install from the sidebar.
  3. Search for go-plus package in the search bar.
  4. Press the Install button for the packge.

After that you can adjust settings or see the README by selecting Packages on the sidebar, finding go-plus and pressing the Settings button.

Now you have a great environment for Go hacking!