“system environment”在IntelliJ的golang插件中的意思是什么?

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

What is the meaning of "system environment" in IntelliJ's golang plugin?

问题

我正在尝试使用IntelliJ的Golang插件,但它显示没有定义GOPATH。

  • 该插件允许您配置一些类似于"GO Libraries"的窗口,但是
  • 不清楚配置的目的是什么,也没有关于应该输入什么的工具提示。
  • 定义了"global libraries"、"project libraries"等等。

在我的情况下,我只是想使用GOPATH。

附上的截图:这里的主要问题是:在使用IntelliJ的Golang插件时,我应该如何设置GOPATH以及在哪里设置?

**一些背景信息:**我不介意在我的Mac上全局设置GOPATH,但对于一个IDE来说,这似乎是一种过于武断的方法。

英文:

“system environment”在IntelliJ的golang插件中的意思是什么?I 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

得分: 0

Go插件目前使用Go Libraries这个术语来表示不同的GOPATH值。
如果你有一个单独的GOPATH想要用于所有项目,你可以将其添加到"Global Libraries"中。例如,我的$GOPATH是/home/florin/golang,在插件中我已经设置了Go Libraries中的Global Libraries来反映这一点(参见此截图)。

“system environment”在IntelliJ的golang插件中的意思是什么?

如果插件能够自动检测到GOPATH,并且你已经勾选了相应的复选框,那么插件将尝试使用该值作为GOPATH值,参见下一个截图。

“system environment”在IntelliJ的golang插件中的意思是什么?

此外,插件目前有三种不同类型的GOPATH值:

  • Global Libraries -> 在这里设置GOPATH条目,用于在不同项目之间共享GOPATH值(大多数情况下使用)
  • Project Libraries -> 在这里设置GOPATH条目,用于当前项目特定的GOPATH值(当你想要每个项目使用单独的GOPATH时)
  • Module Libraries -> 这是一个非常特定的设置,仅在你的项目中有不同的模块并且你想要为每个模块设置不同的GOPATH配置时使用。在这种情况下,模块是IDE中源代码的特定逻辑分组,而不是Go项目使用的包(可以将其视为在同一个项目中拥有Python模块、Go模块和Android模块的能力)。

有一个计划进一步简化这个过程的票,你的意见将被纳入考虑。

希望对你有所帮助。

英文:

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).

“system environment”在IntelliJ的golang插件中的意思是什么?

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

“system environment”在IntelliJ的golang插件中的意思是什么?

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.

huangapple
  • 本文由 发表于 2015年11月21日 00:39:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/33831719.html
匿名

发表评论

匿名网友

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

确定