Reputation: 1330
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.
Upvotes: 5
Views: 13260
Reputation: 23
I had the same problem and I did two things to solve it:
The first step could be replaced by creating a system environment and adding it to the list using the "Select" option instead of creating a new one. I prefered to create a new one so I can run differente projects in the same laptop without having to change the value of the system environment.
Upvotes: 1
Reputation: 131
I had the same error. Putting the source file under a sub-folder in src fixed it.
Upvotes: 13
Reputation: 51
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.
Upvotes: 5
Reputation: 1
Because the executable path is not right.
GoClipse compiles source into $project/bin, so we must set GOPATH = $project
Select project > Alt+Enter > Go Compiler > Use project specific settings > Eclipse GOPATH
In my case of wiki tutorial, GOPATH = :/home/sovann/go/wiki
.
Then the IDE is able to locate /home/sovann/go/wiki/bin/main
Upvotes: 0