setting up atom for golang
Published: January 14, 2016
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.
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.
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
The last step is to install go-plus from Atom.
File | Settingsfrom the menu.
Installfrom the sidebar.
- Search for
go-pluspackage in the search bar.
- Press the
Installbutton for the packge.
After that you can adjust settings or see the README by selecting
the sidebar, finding
go-plus and pressing the
Now you have a great environment for Go hacking!