Problem
Go works fine from the command window, but within IntelliJ you get a message about incorrect SDK version.Assumption
You installed Go using homebrew.Go Environment
Here, we see that Go 1.3.1 is the current installed version:
$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/lex/dev/go/samples"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.3.1/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.3.1/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
Fix IntelliJ Problem
The go-lang-idea-plugin reported that it expected Go version 1.3, but got 1.3.1. So, just remove 1.3 (assuming that you don't need it) and create a symlink fro 1.3 to 1.3.1:
$ cd /usr/local/Cellar/go
/usr/local/Cellar/go $ tdml
.
├── 1.2.2 -> /usr/local/Cellar/go/1.3/
├── 1.3
│ ├── bin
│ ├── etc
│ ├── libexec
│ └── share
└── 1.3.1
├── bin
├── etc
├── libexec
└── share
11 directories
/usr/local/Cellar/go $ rm -rf 1.3
/usr/local/Cellar/go $ ln -s /usr/local/Cellar/go/1.
1.2.2 1.3.1/
/usr/local/Cellar/go $ ln -s /usr/local/Cellar/go/1.3.1 /usr/local/Cellar/go/1.3
Discussion
This feels like such a hack, but I could not find a way to configure the version of the Go SDK for the go-lang-idea-plugin.If anybody finds a better solution, please let us know. Thanks!
The Rest of the Story
I eventually found where to conigure the Go SDK in IntelliJ.File > Folder Structure > Project Settings > Modules > Dependencies
Click the Module SDK dropdown and select the latest Go SDK (In my case it is currently Go SDK go1.3.3 darwin/adm64)
If that is not an option, you may need to click the New... button and select the path that is $GOPATH.
Also, verify that you selected the correct Go SDK in File > Project Structure > Project Settings > Project
References
http://lexsheehan.blogspot.com/2014/08/install-godoc-command.htmlhttps://github.com/go-lang-plugin-org/go-lang-idea-plugin/blob/master/Missing%20ENV.md
https://github.com/go-lang-plugin-org/go-lang-idea-plugin/issues/696
http://brew.sh/
This work is licensed under the Creative Commons Attribution 3.0 Unported License.
Thanks for telling this story.
ReplyDeleteOut call girls