GoClipse / goclipse

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

Fix go oracle errors when project root is not GOPATH. #170

Closed acleone closed 8 years ago

acleone commented 8 years ago

Previously, the project root was being added to the beginning of GOPATH, and jump to definition would error out with errors like:

Error executing `Open definition (go oracle)`.
Could not determine Go package for Go file (/home/alex/myproject/mygopath/src/alex/file.go),

file not in the Go environment.

With GOPATH set to /home/alex/myproject/mygopath and the project root at /home/alex/myproject

This is because the project root was being implicitly added before the other GOPATH changes, and GoPath.java::findGoPackageForLocation(Location goPackageLocation) would find the implicit path first, and try to resolve the package name against '/home/alex/myproject/src' instead of '/home/alex/myproject/mygopath/src'.

bruno-medeiros commented 8 years ago

Hum, I'm thinking that in addition to this, it would be a good thing to actually have a preference option to enable whether the project location is added to the GOPATH or not. Would you be willing to have a go at it, or shall I do it?

acleone commented 8 years ago

Thanks for the merge!

I'm not familiar with the preferences/UI code, so I'll let you take it.