简体   繁体   English

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

[英]Why IntelliJ Idea cannot find location of GO SDK?

  1. I downloaded go1.4.darwin-amd64-osx10.8.tar.gz and extract it on my local directory. 我下载了go1.4.darwin-amd64-osx10.8.tar.gz并将其压缩到我的本地目录中。
  2. Based on what Installing to a custom location says I added GOROOT in env variable. 根据安装到自定义位置的说法,我在env变量中添加了GOROOT。
  3. Based on what Test your installation says I created a go file. 基于测试您的安装说我创建了一个go文件。
  4. I finally ran it and I got expected result as following screenshot. 我终于运行了它,我得到了预期的结果,如下面的截图。

在此输入图像描述

  • 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. 我实际上有IntelliJ v.14但是,基于这篇文章,我在我的IntelliJ Idea中安装了Go Language (golang.org) golang.org Go Language (golang.org) 0.9.15.3版本。
  • I created a Go project and during creation it asked me to add GO SDK. 我创建了一个Go项目,在创建过程中它要求我添加GO SDK。 I gave it ~/Desktop/go/sdk however it wasn't able to recognise it. 我给了它~/Desktop/go/sdk然而它无法识别它。 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 14:03:02 IllegalArgumentException:com / intellij / openapi / projectRoots / impl / ProjectRootContainerImpl.addRoot的@NotNull参数'virtualFile'的参数不能为null

Any idea how IntelliJ Idea is able to recognize it would be appreciated. 任何想法IntelliJ Idea如何能够识别它将不胜感激。 Thanks. 谢谢。

Please consider using one of the alpha releases for 0.9.16. 请考虑使用0.9.16的alpha版本之一。 I believe that alpha7 could be the more stable one rather than alpha9. 我相信alpha7可能是更稳定的而不是alpha9。 You can get them from GitHub releases 你可以从GitHub版本中获取它们

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. 顾名思义,v1.0.0-alpha0分支是一个alpha版本,它处于开发的早期阶段,这就是为什么它还没有完成发布的原因。

PS I'm one of the contributors to the plugin. PS我是该插件的贡献者之一。

Does not allow to use SDK placed in /usr/local/go (perfectly valid and recent SDK) under Mac Yosemite. 不允许在Mac Yosemite下使用位于/ usr / local / go(完全有效且最近的SDK)的SDK。 Google App Engine does not recognise last valid GAE GO SDK either. Google App Engine无法识别上一个有效的GAE 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. ~Desktop/go/sdk似乎不是一个有效的路径(因为它指的是' Desktop '用户的homedir): ~/Desktop/go/sdk应该更好。

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 ". 只要你在~/Desktop/go/sdk文件夹中看到子文件夹' api ',' bin ',' blog ',...,这应该是“ golang支持插件所期望的GO SDK的正确文件夹” ”。

Some issues exist with that plugin and IntelliJ 14: issues 1169 , PR 1172 (fixed for for 1.0.0-alpha). 该插件和IntelliJ 14存在一些问题: 问题1169PR 1172 (针对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: 指定Go SDK路径的最终结果应如下所示:

http://pivotallabs.com/wordpress/wp-content/uploads/2013/12/Screen-Shot-2013-12-09-at-4.53.20-PM.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM