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.

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

报告相同问题?

悬赏问题

  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因