Golang on eclipse:“资源没有相应的Go包”在Mac上 [英] Golang on eclipse: "Resource doesn't have a corresponding Go package" on Mac
问题描述
目前,安装的文件夹如下。
/usr/local/Cellar/go/1.5.2 /..
运行终端后,输入 open〜/ .bash_profile
我添加了以下内容。
export GOROOT =/ usr / local / Cellar / go / 1.5.2 /
export PATH = $ PATH:$ GOROOT / bin
我还缺少其他东西吗?
PS 如果我运行代码使用终端像 go run main.go
,我绝对没有问题。这个问题必须归结于Eclipse中的一些错误配置。
转到运行配置 - >选择您的项目,然后单击环境选项卡,然后单击选择按钮并勾选GOPATH环境。选择申请,然后选择运行。
As stated in the title, I have a problem running the Golang code on Eclipse. I'm currently using Mac, and I installed go by using homebrew.
Currently, the folder where go is installed is as follows.
/usr/local/Cellar/go/1.5.2/..
and after running Terminal and typing open ~/.bash_profile
I added the following.
export GOROOT="/usr/local/Cellar/go/1.5.2/"
export PATH=$PATH:$GOROOT/bin
Am I still missing something else?
PS If I run the code using Terminal like go run main.go
, I have absolutely no problem. The problem must be due to some misconfiguration in Eclipse.
Go to 'Run Configurations' -> Filter with Go Application -> select your project and then click the Environment tab, then click on select button and tick the GOPATH environment. select apply and then Run.
这篇关于Golang on eclipse:“资源没有相应的Go包”在Mac上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!