I installed goclipse in my eclipse, and setup the preferences as follows :
Now when I create a new GoFile (HelloWorld.src), the file is saved in D:/GO/TestProject/src. But when I build the same file, the bin and pkg folders are empty and hence when I run the file the following error comes :
resource does not have a corresponding go package
Unable to run the code because of this error.
Your project path should be D:\GO\src\TestProject
in order to match the workspace expected as described in https://golang.org/doc/code.html
Then, your GOPATH should point to D:\GO
(NOT ...\src
)
The go tool will automatically use $GOPATH/src
, $GOPATH/bin
or $GOPATH/pkg
when appropiate for each case.
And as icza pointed out, your program should have a package main
statement on the top of your go file to be recognized as an executable, unless you want to create a package, in that case, you should name your package as you want.