0

I'd like to learn Go and attempted to setup the Go plugin for IntelliJ on IntelliJ IDEA 14.1.3. I'm running OSX Yosemite (10.10.3).

I installed go using Brew: brew install go.

I'm unable to setup the SDK as I go through the new project wizard. The Project SDK is empty, when I click 'Configure', and navigate to the libexec folder of the installation (/usr/local/Cellar/go/1.4.2/libexec/), the Project SDK never is never displayed in the box. If I click through the wizard, it warns me that no SDK was specified, and then warns that GOROOT and GOPATH env variables are empty of could not be detected.

It seems there are quite a few ways to set environment variables on OSX. I created an ~/Library/LaunchAgents/environment.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>my.startup</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>
    launchctl setenv GOROOT "/usr/local/Cellar/go/1.4.2/libexec/"
    launchctl setenv GOPATH "/Users/awoolford/golang/"
    </string>

  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

If I run launchctl load -w ~/Library/LaunchAgents/environment.plist the environment variables are loaded:

$ launchctl getenv GOPATH
/Users/awoolford/golang/

$ launchctl getenv GOROOT
/usr/local/Cellar/go/1.4.2/libexec/

I would have expected IntelliJ to recognize these environment variables, and that I'd be able to create a project in ~/golang/.

Can you see what I'm doing wrong?

Community
  • 1
  • 1
Alex Woolford
  • 4,433
  • 11
  • 47
  • 80

0 Answers0