How to configure GOPATH?

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

How to configure GOPATH?

问题

我安装了Goland作为Go IDE,并且它要求我配置GOPATH。我对这门语言还不熟悉,所以不知道该怎么做。以下是错误信息:

> 检测到GOPATH
我们检测到您的GOPATH中存在一些库。
您可能希望在GOPATH配置中添加额外的库。

编辑:这不是一个重复的问题,export GOROOT=""解决了我的问题。不管怎样,谢谢。

英文:

I installed Goland as a Go IDE and it wants me to configure GOPATH. I'm new in this language so I don't know what to do. Here is the error message:

> GOPATH was detected
We've detected some libraries from your GOPATH.
You may want to add extra libraries in GOPATH configuration.

Edit: Not a duplicate question, export GOROOT=""solved my problem. Thanks anyway.

答案1

得分: 7

你实际上不需要设置GOPATH环境变量;在Go 1.8中,默认情况下是~/go

我建议你只需更新到最新的稳定版Go(1.8),并使用这个约定;否则你需要在环境中设置GOPATH变量。

英文:

You actually do not need to set the GOPATH environment variable; in Go 1.8 it's ~/go by default.

I suggest that you just update to latest stable Go (1.8) and use that convention; otherwise you'll need to set the GOPATH variable in your environment.

答案2

得分: 2

你需要设置GOPATH环境变量。如何设置取决于你的操作系统。

以下是设置PATH环境变量的示例,只需修改指令以设置GOPATH即可。

另请参阅如何编写Go代码,了解有关设置工作区和GOPATH的更多详细信息。

英文:

You need to set the GOPATH environment variable. How you do this varies depending on your operating system.

Here are examples of how to set the PATH environment variable, just modify the instructions to set GOPATH instead.

Also see How to Write Go Code for more details on setting up your workspace and setting GOPATH.

答案3

得分: 1

export GOROOT="" 为某种原因解决了问题。

英文:
export GOROOT=""   

solved the issue for some reason.

huangapple
  • 本文由 发表于 2017年2月20日 02:57:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/42331452.html
匿名

发表评论

匿名网友

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

确定