douhao7677 2015-11-20 16:39
浏览 113
已采纳

IntelliJ的golang插件中的“系统环境”是什么意思?

enter image description hereI was attempting to use intellij's golang plugin, but it sais there is no GOPATH defined.

  • the plugin allows you to configure some sort of "GO Libraries" window, however
  • Its not clear what the configuration is meant to do, and there are no tool tips regarding what should be entered.
  • There are "global libraries", "project libraries", and so on defined.

In my case, I simply want to use a GOPATH.

Screenshot attached: The primary question here: How and where should I set GOPATH when using intellij's Golang plugin?

Some context: I don't mind setting gopath globally on my mac, but it seems that is a heavy-handed approach for an IDE to use**

  • 写回答

1条回答 默认 最新

  • duanmu5641 2015-11-21 13:13
    关注

    the Go plugin currently uses the term Go Libraries for different GOPATH values. If you have a single GOPATH that you'd like to use for all the projects, then you can add it to the "Global Libraries". For example, my $GOPATH is /home/florin/golang and in the plugin I've set the Global Libraries from the Go Libraries setting to reflect that (see this screenshot).

    Single GOPATH manual setting

    If the plugin can automatically detect the GOPATH, and you have the check box ticked for that, then the plugin will try and use that value as the GOPATH value, see the next screenshot

    Automaticaly detected GOPATH

    Also, the plugin has three different types of GOPATH values right now:

    • the Global Libraries -> you should set GOPATH entries here for GOPATH values that you want to share between different projects (most use-cases)
    • Project Libraries -> you should set the GOPATH entries here for GOPATH values that are specific to the current project only (when you want to have a single GOPATH per project approach)
    • Module Libraries -> this is a very specific setting, it's only used in case you have different modules in your project and you want to have a different GOPATH configuration for each of the modules. The module in this case is a specific logical grouping of the source code in the IDE, not in the packages that the Go project uses (think of the ability to have a Python module, a Go module and an Android module all in the same project).

    There's a ticket that plans to simplify this further and your input will be included.

    Hope it helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示