Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Setting up the Google Go plugin with IntelliJ IDEA 13 on OS X 10.8.5

Last night I decided to take a crack at getting my environment more appropriately setup for Go programming.  Being a huge fan of both RubyMine and IDEA, and having recently downloaded the latest versions of both, I set out to install the latest and greatest version of Mihai Toader’s Google Go Lang IDEA Plugin

Turns out that involves a few non-obvious steps.  Most of this info I mined from the project wiki.  Here I have laid it out in a (hopefully) easy-to-follow tutorial.

Before you Begin

To get started you will need:

  • Version 1.2 of Go (I installed it via brew)
  • IntelliJ IDEA 13 Community Edition downloaded from (build 133.193 atm)


Standard GOPATH configuration as described on is to have a single workspace with singular src, pkg and bin directories containing multiple projects.

IDEA’s Go plugin, however, subscribes to the multiple workspace theory (aka the one-workspace-per-project theory).   This means if you want to use the IDEA Go plugin, you need multiple workspaces.  Thus your GOPATH env variable should look like so:


Each entry in GOPATH is a full Go directory structure with src, bin and pkg directories. The first entry is special — that’s the one where all external packages are installed.  The rest are your projects.

Because of this multi-workspace approach you’ll need some special sauce to get all your bins on the path.  Set your PATH env variable like so:


Compiling the plugin

First thing to note:  You should not simply download the plugin from IDEA’s plugin repo. That version is old.

Instead, we’re going to grab the latest version of the plugin from github and compile it ourselves:

git checkout

Got the code?  Great.  Next step is to fire up IntelliJ IDEA 13 and open the project for compilation.  File -> Open -> ~/workspace/google-go-lang-idea-plugin

Here’s where it gets tricky.  At the top of the IDE you should see the following message: “Project SDK is not defined” and a link to “Setup SDK”.  Like so:

Screen Shot 2013-12-09 at 4.19.55 PM

Click on “Setup SDK”, followed by “Configure”.  You’ll see the following screen (ignore the Go SDK in the screenshot.  You shouldn’t actually see it till later):

Screen Shot 2013-12-09 at 4.22.43 PM

Click the left most + sign to add an additional SDK.  Select “IntelliJ Platform Plugin SDK” from the drop down list.  Now navigate to your “IntelliJ IDEA 13” location and select it (in my case the path is /Applications/IntelliJ IDEA 13  Click “Choose”, followed by “OK” when prompted to select 1.6 as the SDK.

The window should now look like this (minus that Go SDK):

Screen Shot 2013-12-09 at 4.32.37 PM

Click OK, then OK again when it asks you to “Select Project SDK”.

Now the plugin can find the necessary IDEA class references for compilation!

You can try clicking make project at this point to make sure it works (green down arrow with 1’s and 0’s up top).  Finally, navigate to the Build menu and select Prepare Plugin Module ‘google-go-language’ For Deployment.  This will drop a jar file (google-go-language.jar) at the top level of the google-go-lang-idea-plugin directory.

Installation and Configuration

Almost Done!  Now, inside of IDEA, navigate to Preferences.  From there select Plugins and click on “Install plugin from disk…”.  Find the jar file you created (google-go-language.jar) and select it.

The plugin is installed!  Now to add a Go SDK:

Open up your Project Structure from the File menu and select SDKs on the left.  Click the top-most plus sign and select “Go Sdk”.  Navigate to your Go installation directory and find the libexec directory (if you installed through brew this is most likely at /usr/local/Cellar/go/1.2/libexec/).

Now you have a Go SDK!  Final step is to configure its Classpath and Sourcepath so it will recognize your package code:

Navigate back to your Project Structure and select SDKs on the left once again.  Select the Go SDK and take a look at the Classpath and Sourcepath on the right.  To each of these (yes, both Classpath and Sourcepath.  Not sure why but that was the magic incantation), you’ll need to add the path to the src and pkg directories in the first workspace in your GOPATH.  Click the lowermost plus button and add the following paths (from my own machine for the sake of example):

  • /Users/pivotal/workspace/golang/src
  • /Users/pivotal/workspace/golang/pkg/darwin_amd64

When you’re done it should look like:

Screen Shot 2013-12-09 at 4.53.20 PM

Click apply, followed by OK.

Invalidate the Caches

As a final step go to File -> Invalidate Caches / Restart…


Now you’re ready to develop in Go… with pleasure!

  1. Sam Ghods says:

    Thanks for the writeup, this is very helpful. However, I found an alternative way to compile the plugin that is a bit simpler and gave me better results. It’s described here:

  2. Kai Koenig says:

    Ross, thanks for the writeup – that’s very useful.

    I tried to compile from the latest master branch sources from Github (0.9.15) with IntelliJ IDEA 13 today. While the build process works fine and creates a deployable .jar file, it wasn’t possible to load the resulting .jar file as a plugin in IntelliJ’s preferences. Turns out that the current version needs to run on a certain minimum build of IntelliJ IDEA 13 and therefore one’s installation needs to have the update to 13.0.1 applied first. Maybe this info is useful for others.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *