GoClipse / goclipse

Eclipse IDE for the Go programming language:
http://goclipse.github.io/
Eclipse Public License 1.0
841 stars 290 forks source link

Project doesn't build if it doesn't have a src folder #249

Closed leonelquinteros closed 6 years ago

leonelquinteros commented 7 years ago

Goclipse version: GoClipse 0.16.1.v201607061938 goclipse_feature.feature.group github.com/GoClipse/

When trying to build a project that resides inside the GOPATH (as any Go developer would have following the official docs at https://golang.org/doc/code.html ) i get the following error.

Error, using location `/Users/leo/Dev/go/src/github.com/leonelquinteros/gotext` as a Go workspace, but location does not contain a `src` directory. 

My GOPATH points to the right directory:

echo $GOPATH
/Users/leo/Dev/go

The Goclipse User Guide says:

The project location is a subfolder of the 'src' folder of some GOPATH entry. The project will then consist of the Go source packages contained there.

And this is the way any Go developer would go with, there is no much reason, other than exceptions, to have a different setup, and certainly, having the src/pkg/bin directories inside the code repository doesn't make much sense to me.

bruno-medeiros commented 7 years ago

The GOPATH that Goclipse uses might be different from the GOPATH environment variable. It seems that somehow /Users/leo/Dev/go/src/github.com/leonelquinteros/gotext is being added to it, although that should not be the case.

What's the full output of the Go build console in Eclipse? It should mention which GOPATH it tried to use. For example:

====================  Starting Go build  ====================
************  Building Go project: blah  ************
  with GOPATH: D:\devel\go-workspace
>> Running: D:\devel\tools\go\bin\go.exe install -v -gcflags "-N -l" com.myproj/bruno/...
leonelquinteros commented 7 years ago

Actually, there is no output in the console, the error message is displayed in a popup.

screen shot 2017-07-03 at 15 55 09

But based on your comment, i've been able to solve the issue:

On Preferences -> Go -> Eclipse GOPATH i had Use same value as the GOPATH environment variable checked.

So i've unchecked that and manually entered the same value from $GOPATH and now it works. It seems like Eclipse or Goclipse can't read the environment variable from my user or something. Not sure it that's something you want to check or you can reproduce.

I'm using:

Let me know if you want help digging into this, but it's solved by setting the GOPATH manually in the Eclipse configuration.

bruno-medeiros commented 7 years ago

Sometimes there's issues in Mac OS in where an env var is set but it applies only to the console, but not to apps started through the UI, maybe that's the issue?

If you check Use same value as the GOPATH environment variable, the value that will appear in the now disabled text box, is the value that Goclipse sees as the GOPATH. So if that value is different from what you entered manually, it's prob the env-var configuration mismatch on your OS. Otherwise, it might be Goclipse bug.

leonelquinteros commented 6 years ago

That seems to be the reason. Then the check is marked, the input field is empty, so it looks like Eclipse isn't reading the environment variable.

Thanks for your support!