为什么IntelliJ Idea找不到GO SDK的位置?

huangapple go评论90阅读模式
英文:

Why IntelliJ Idea cannot find location of GO SDK?

问题

  1. 我下载了go1.4.darwin-amd64-osx10.8.tar.gz并将其解压到本地目录。
  2. 根据Installing to a custom location所说,我在环境变量中添加了GOROOT。
  3. 根据Test your installation所说,我创建了一个go文件。
  4. 最后我运行了它,并得到了预期的结果,如下所示的截图。

为什么IntelliJ Idea找不到GO SDK的位置?

  • 实际上,我使用的是IntelliJ v.14,但是根据这篇文章,我在我的IntelliJ Idea中安装了Go Language (golang.org)版本0.9.15.3。
  • 我创建了一个Go项目,在创建过程中它要求我添加GO SDK。我给了它~/Desktop/go/sdk,但它无法识别它。在事件日志中我得到了以下错误:

> 14:03:02 IllegalArgumentException: Argument for @NotNull parameter
> 'virtualFile' of
> com/intellij/openapi/projectRoots/impl/ProjectRootContainerImpl.addRoot
> must not be null

有任何关于IntelliJ Idea如何识别它的想法将不胜感激。谢谢。

英文:
  1. I downloaded go1.4.darwin-amd64-osx10.8.tar.gz and extract it on my local directory.
  2. Based on what Installing to a custom location says I added GOROOT in env variable.
  3. Based on what Test your installation says I created a go file.
  4. I finally ran it and I got expected result as following screenshot.

为什么IntelliJ Idea找不到GO SDK的位置?

  • I actually have IntelliJ v.14 however, based on this article I installed Go Language (golang.org) version 0.9.15.3 in my IntelliJ Idea.
  • I created a Go project and during creation it asked me to add GO SDK. I gave it ~/Desktop/go/sdk however it wasn't able to recognise it. I got this error in Event Log:

> 14:03:02 IllegalArgumentException: Argument for @NotNull parameter
> 'virtualFile' of
> com/intellij/openapi/projectRoots/impl/ProjectRootContainerImpl.addRoot
> must not be null

Any idea how IntelliJ Idea is able to recognize it would be appreciated. Thanks.

答案1

得分: 10

请考虑使用0.9.16版本的alpha发布之一。我认为alpha7可能比alpha9更稳定。你可以从GitHub releases获取它们。

v1.0.0-alpha0分支是一个alpha版本,正如其名称所示,它处于开发的早期阶段,这就是为什么还没有发布的原因。

附言:我是该插件的贡献者之一。

英文:

Please consider using one of the alpha releases for 0.9.16. I believe that alpha7 could be the more stable one rather than alpha9. You can get them from GitHub releases

The v1.0.0-alpha0 branch is, as the name implies, an alpha release and it's in the early stages of development, that's why there's no release done yet for it as well.

P.S. I'm one of the contributors to the plugin.

答案2

得分: 2

不允许在Mac Yosemite下使用位于/usr/local/go(完全有效和最新的SDK)的SDK。
Google App Engine也不识别最新的有效GAE GO SDK。

英文:

Does not allow to use SDK placed in /usr/local/go (perfectly valid and recent SDK) under Mac Yosemite.
Google App Engine does not recognise last valid GAE GO SDK either.

答案3

得分: 1

~Desktop/go/sdk 似乎不是一个有效的路径(因为它引用了“Desktop”用户的主目录):~/Desktop/go/sdk 应该更好地工作。

只要在 ~/Desktop/go/sdk 文件夹中看到子文件夹 apibinblog 等,那应该就是“golang support plugin”所期望的正确路径。

该插件与 IntelliJ 14 存在一些问题:issues 1169PR 1172(已修复为 1.0.0-alpha 版本)。
另一种方法是重新编译和安装该插件

指定 Go SDK 路径的最终结果应该如下所示:

为什么IntelliJ Idea找不到GO SDK的位置?

英文:

~Desktop/go/sdk doesn't seems a valid path (as it refers to the homedir of the 'Desktop' user): ~/Desktop/go/sdk should work better.

As long as you see in that ~/Desktop/go/sdk folders the subfolders 'api', 'bin', 'blog', ..., that should be the right one for the GO SDK expected by the "golang support plugin".

Some issues exist with that plugin and IntelliJ 14: issues 1169, PR 1172 (fixed for for 1.0.0-alpha).
The other approach is to recompile and install that plugin.

The end result of specifying the Go SDK path should look like:

为什么IntelliJ Idea找不到GO SDK的位置?

huangapple
  • 本文由 发表于 2015年1月14日 14:14:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/27936844.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定