GoClipse / goclipse

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

trying to use "Download" from inside eclipse preferences gives error #214

Closed maxandersen closed 8 years ago

maxandersen commented 8 years ago

I have Go installed and GOPATH set.

gocode is not installed and when I run the "Download" I get this error:

==== Starting gocode server ====
/Users/max/go/bin/gocode set propose-builtins true
  FAILED: Cannot run program "/Users/max/go/bin/gocode": error=2, No such file or directory   Reason: Cannot run program "/Users/max/go/bin/gocode": error=2, No such file or directory
>> Running: /usr/local/bin/go get -u github.com/nsf/gocode
package bytes: unrecognized import path "bytes" (import path does not begin with hostname)
package encoding/binary: unrecognized import path "encoding/binary" (import path does not begin with hostname)
package encoding/json: unrecognized import path "encoding/json" (import path does not begin with hostname)
package errors: unrecognized import path "errors" (import path does not begin with hostname)
package flag: unrecognized import path "flag" (import path does not begin with hostname)
package fmt: unrecognized import path "fmt" (import path does not begin with hostname)
package go/ast: unrecognized import path "go/ast" (import path does not begin with hostname)
package go/build: unrecognized import path "go/build" (import path does not begin with hostname)
package go/parser: unrecognized import path "go/parser" (import path does not begin with hostname)
package go/scanner: unrecognized import path "go/scanner" (import path does not begin with hostname)
package go/token: unrecognized import path "go/token" (import path does not begin with hostname)
package io: unrecognized import path "io" (import path does not begin with hostname)
package io/ioutil: unrecognized import path "io/ioutil" (import path does not begin with hostname)
package log: unrecognized import path "log" (import path does not begin with hostname)
package net: unrecognized import path "net" (import path does not begin with hostname)
package net/http: unrecognized import path "net/http" (import path does not begin with hostname)
package net/http/pprof: unrecognized import path "net/http/pprof" (import path does not begin with hostname)
package net/rpc: unrecognized import path "net/rpc" (import path does not begin with hostname)
package os: unrecognized import path "os" (import path does not begin with hostname)
package os/exec: unrecognized import path "os/exec" (import path does not begin with hostname)
package path: unrecognized import path "path" (import path does not begin with hostname)
package path/filepath: unrecognized import path "path/filepath" (import path does not begin with hostname)
package reflect: unrecognized import path "reflect" (import path does not begin with hostname)
package runtime: unrecognized import path "runtime" (import path does not begin with hostname)
package sort: unrecognized import path "sort" (import path does not begin with hostname)
package strconv: unrecognized import path "strconv" (import path does not begin with hostname)
package strings: unrecognized import path "strings" (import path does not begin with hostname)
package sync: unrecognized import path "sync" (import path does not begin with hostname)
package text/scanner: unrecognized import path "text/scanner" (import path does not begin with hostname)
package time: unrecognized import path "time" (import path does not begin with hostname)
package unicode: unrecognized import path "unicode" (import path does not begin with hostname)
package unicode/utf8: unrecognized import path "unicode/utf8" (import path does not begin with hostname)
   ^^^ Terminated, exit code: 1 ^^^

running /usr/local/bin/go get -u github.com/nsf/gocode from command line works fine.

bruno-medeiros commented 8 years ago

What is your GOPATH set to in Eclipse, and is the same as the command-line? And what is GOROOT? Are you running Linux or OS X?

bruno-medeiros commented 8 years ago

Nevermind, I believe I have found the problem: Goclipse is setting the GOROOT environment variable for calling the Go tool. This cames from old code written by someone else, and I'm not sure it's actually valid. Whilst a custom GOPATH will definitely need to be passed to Go tooling invoked by Goclipse, a google search about that error (and others) seems to indicate one should not normally need to set GOROOT.

bruno-medeiros commented 8 years ago

Building a Go project also fails, for a similar reason.

BTW, the workaround is to use a Go installation from a download archive, as opposed to using a package manager that install the go executable in /usr/bin and the rest of the Go files in other directories.

maxandersen commented 8 years ago

thanks - to be sure i understand it you are saying after this fix users should use "custom" installed go install - can't use the one provided for i.e. Go on OSX on golang.org which installs into /usr/local/bin ?

or are you saying after this fix that will work and its just a workaround for current version of goeclipse ?

bruno-medeiros commented 8 years ago

The workaround is just for current release of Goclipse. The fix will makes it work for any Go installation, no need for workaround.

maxandersen commented 8 years ago

Excellent! I asked since the line in changelog.md at https://github.com/GoClipse/goclipse/commit/896902eadd9d1994a0b32eb9e400b781be0f8a36#diff-b3cb6b7d6182d7ade5ea656f94f4ba5bR10 seem to indicate it would be a new problem.

bruno-medeiros commented 8 years ago

Yeah, there's sometimes bad grammar in the ChangeLog, or unclear statements. They all get reviewed/cleaned-up before a release though.

bruno-medeiros commented 7 years ago

@maxandersen I've reverted the fix for this issue (see https://github.com/GoClipse/goclipse/issues/247)

It seems the correct thing is to set the GOROOT environment variable. So if this problem occurs again, we'll have to look into again, and find some other way to fix it.