简体   繁体   中英

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

在此处输入图片说明 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**

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

单个GOPATH手动设置

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

自动检测到的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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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