Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Golang on eclipse: "Resource doesn't have a corresponding Go package" on Mac

Tags:

eclipse

go

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.

like image 579
MarshallLee Avatar asked Jan 13 '16 20:01

MarshallLee


2 Answers

I had the same error. Putting the source file under a sub-folder in src fixed it.

like image 100
Ahmad Bilal Avatar answered Sep 29 '22 18:09

Ahmad Bilal


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.

like image 45
Venugopal V Avatar answered Sep 29 '22 18:09

Venugopal V