简体   繁体   中英

How to cross-reference in GoClipse?

I have installed Eclipse (Mars) with Goclipse plugin on my Macbook yesterday. They initially work perfectly. But today I found I cannot do cross reference (that means cmd+click on a keyword cannot jump the definition). And the console shows:

 Running: oracle -pos=/Users/myname/coreos/naas/server/src/mycompany.com/hh/naas-server/main.go:#389,#389 -format=json describe mycompany.com/hh/naas-server FAILED: Could not start process: Reason: Cannot run program "oracle": error=2, No such file or directory 

As Voker suggested, GoClipse is just an Eclipse plugin. For it to compile, build, run your Go packages and applications, it requires the Go tools.

You can set the standard Go tool on the settings page:

Window -> Preferences -> Go

You can set some non-standard, differnet Go tools on the page:

Window -> Preferences -> Go -> Tools

This is where you can tell GoClipse where your oracle and gocode programs are located.

You have to download oracle yourself, but the settings page above provides you a button:

Download Go oracle (run: `go get -u golang.org/x/tools/cmd/oracle`)

So you have to go get it either manually or by the above-mentioned button. Install it using go install , so you will have the executable binary oracle . You have to set the full path of oracle on the Go -> Tools settings page, and it will work.

While we're at it: I also recommend you to install gocode ( https://github.com/nsf/gocode ) which will provide you the auto-complete feature ( CTRL+SPACE or CMD+SPACE for a list of exported identifiers in package, list of methods etc.). Just also use the button on the same settings page:

Download gocode (run: `go get -u github.com/nsf/gocode`)

Install it and set the full path of the resulted executable binary gocode .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM