dpikoto468637 2013-07-21 09:57
浏览 1255
已采纳

我使用IntelliJ IDEA作为golang IDE,并且系统环境已经设置了GOPATH,但是IDEA无法加载它

I use IntelliJ IDEA as golang IDE in Windows , and system environment have already set GOPATH,but IDEA can't load $GOPATH.

I use go get github.com/astaxie/beego, this package is installed correctly, but in IDEA can't import this library.

I have added this package in project's structure in this way:

enter image description here

and this project's choice “Go sdk go1.1.1 windows/amd64 ”like enter image description here

how can I set GOPATH in idea?

  • 写回答

6条回答 默认 最新

  • duangonglian6028 2014-01-25 14:26
    关注

    Update (2017-10-22)

    According to the release notes of the new version of Gogland (EAP 16), the corresponding Go plugin can only be used with IntelliJ IDEA Ultimate from now on. This follows the pattern of providing support for different languages either via a plugin for IntelliJ IDEA Ultimate, or as a standalone IDE, such as PyCharm, Webstorm, or in this case, Gogland.

    For more details see the related blog post.

    Update (2017-04-24)

    As an alternative solution that ultimately deals with the OP's problem, I would like to recommend the new IDE specifically for Go development, JetBrains Gogland. The setup is pretty much effortless, but in case you would have difficulties, there is already heplful documentation provided.

    Check Gogland, might work for you.

    There is also an official plugin that "has everything you could find in Gogland".

    In case you are wondering what could be the difference between this new plugin, and the old go-lang-idea-plugin, check the FAQ article with the explanation.

    Original answer

    Background info

    On OS X Mavericks, Go installed via Macports. Using Go plugin version 0.9.15 with IntelliJ IDEA.

    Problem

    I wanted to make the IDE understand the imports and provide autocomplete for any package I have installed in GOPATH. (I started creating an app using Revel and were missing the autocomplete...)

    Solution

    Here is what I did:

    • Configure the Go SDK (In menu: View > Open Library Settings > Platform Settings > SDKs).
    • Open the "Classpath" tab of the Go SDK you want to set up.
    • Add a new item, select the 'src' directory in your $GOPATH.
    • Click 'Apply' or 'OK'.
    • (not working!?!?, grumble, headache...)
    • In menu: File > Invalidate Caches / Restart...
    • Click 'Invalidate and Restart'.
    • WIN!

    Hope this might be what you were looking for!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记