How to set up GoCode for GoClipse?

7.7k views Asked by At

After reading the guide on https://github.com/nsf/gocode, I tried the command go get -u -ldflags -H=windowsgui github.com/nsf/gocode. I don't get any response after this command.

enter image description here

I also found that there is a place in GoClipse that can let me input the path of GoCode. So, I think maybe I already have GoCode in my windows pc but what is its location? enter image description here

4

There are 4 answers

0
OneOfOne On BEST ANSWER

go get won't output anything unless there's an error.

The location for anything you install with the go tools is $GOPATH/bin, $GOPATH depends on your environment.

If you're not sure where it is, run go env and it will print a list of the environment variables that Go uses, including GOPATH.

0
Bassel Kh On

just go to the command line and type: go env

Navigate to GOPATH directory in windows, you will find bin folder underneath, open the folder, you will see all the required exe files installed, just mentioned them in eclipse, Example from my env:

  • Check the GOPATH folder

enter image description here

  • Navigate to the GOPATH folder\bin, and make sure that the required exe file are installed enter image description here
  • Set the exe paths in eclipse

enter image description here

  • Here is the result enter image description here
0
Ubercool On

Navigate to Window -> Preferences -> Go -> Tools Easiest and quickest way is to click the download buttons under gocode, guru and godef. Eclipse will automatically do the rest of things for you.

enter image description here

0
Jbartmann On

One quick addition to the other answers suggesting to using the Download buttons in Eclipse to download gocode, guru and godef.

The commands produced by Eclipse are no longer working as go get is deprecated.

Use these commands instead (via cmd).

  • "C:\Program Files\Go\bin\go.exe" install github.com/nsf/gocode@latest
  • "C:\Program Files\Go\bin\go.exe" install golang.org/x/tools/cmd/guru@latest
  • "C:\Program Files\Go\bin\go.exe" install github.com/rogpeppe/godef@latest

Then browse in Eclipse (Window -> Preferences -> Go -> Tools) for the respective .exe files:

enter image description here