Golang on eclipse:“资源没有相应的Go包”在Mac上 [英] Golang on eclipse: "Resource doesn't have a corresponding Go package" on Mac

查看:336
本文介绍了Golang on eclipse:“资源没有相应的Go包”在Mac上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如标题所述,我在Eclipse上运行Golang代码时遇到问题。我目前正在使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆