- Text Editor (Sublime)
- Golang IDE (IntelliJ)
Golang IDE Honorable MentionsOther Golang Dev IDEs include:
- Atom + the go-plus package
- Vim with the vim-go plugin
- Vim with syntastic
- Vim with dotfiles
- emacs + go-mode
Text EditorI use Sublime Text + GoSublime for my golang text editor.
Golang IDEI use Jetbrains tools for a lot of reasons. Here are a few:
- Go application compilation
- Syntax highlighting
- Declaration navigation
For a more complete list see: http://lexsheehan.blogspot.com/2014/03/go-language-intellij-idea-plugin.html
The Golang plugin only works with IntelliJ.
Fortunately, there is a free "Community" version available here: http://www.jetbrains.com/idea/download/
Install the go-language-intellij-idea-plugin from the menu:
IntelliJ IDEA (main menu) > Preferences ... > Plugins
Click "Install JetBrains plugin..." and enter golang as the search term
Then, click the install button for the go-language-intellij-idea-plugin
Download latest build from: go-lang-plugin-org/go-lang-idea-plugin
You'll also need to set the Go SDK in the File > Project Structure > Dependencies
Click New... and the path of the desired Go runtime, e.g., /usr/local/Cellar/go/1.4/libexec
Declaration Navigation Broken?
If you see red warnings with messages that say something like, "cannot find declaration to go to", then from the menu: File > Invalidate Caches / Restart...
Tips on Configuring Your Go Development Environment
Install GoBefore you begin working with Go, use Homebrew to install it.
$ brew install go $ go version go version go1.2.2 darwin/amd64
Your go version may be different.
~/.bashrcConfigure GOROOT, GOPATH and PATH in ~/.bashrc
You can also put this in other startup files, but I prefer ~/.bashrc
export GOPATH=$HOME/dev/go export GOROOT=`go env GOROOT` export PATH=$PATH:$GOROOT/bin
Homebrew VersionIf you used Homebrew to install go, then GOROOT must end in "libexec"; Otherwise, you'll get errors like this:
~/dev/go/samples/src/bitbucket.org/l3x/hello $ go install hello.go:4:3: cannot find package "fmt" in any of: /usr/local/Cellar/go/1.2.2/src/pkg/fmt (from $GOROOT) /Users/lex/dev/go/samples/src/fmt (from $GOPATH) package bitbucket.org/l3x/hello imports runtime: cannot find package "runtime" in any of: /usr/local/Cellar/go/1.2.2/src/pkg/runtime (from $GOROOT) /Users/lex/dev/go/samples/src/runtime (from $GOPATH)
/etc/launchd.confConfigure GOROOT and GOPATH in /etc/launchd.conf
Create the file if it does not already exist.
setenv GOROOT $GOROOT setenv GOPATH $GOPATH
Enable launchctl settings without rebooting:
$ launchctl setenv GOROOT $GOROOT $ launchctl setenv GOPATH $GOPATH
Enable launchctl settings if you start IntelliJ from spotlight.
If you start IntelliJ from the command line, this won't be necessary.
This work is licensed under the Creative Commons Attribution 3.0 Unported License.