I have godef installed via
go get github.com/rogpeppe/godef
I have emacs go-mode installed, and the following exports in my .bashrc:
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
godef is found in the sense that
godef -h # appears to work.
As in:
$ godef -h
usage: godef [flags] [expr]
-A print all type and members information
-a print public type and member information
-acme
use current acme window
-debug
debug mode
-f string
Go source filename
-i read file from stdin
-json
output location in JSON format (-t flag is ignored)
-o int
file offset of identifier in stdin (default -1)
-t print type information
When I run C-c C-d
in a file in my emacs session, which should be calling a godef-describe
function per
https://github.com/dominikh/go-mode.el
I expect:
Integration with godef
godef-describe (C-c C-d) to describe expressions
godef-jump (C-c C-j) and godef-jump-other-window (C-x 4 C-c C-j) to jump to declarations
This requires you to install godef via go get github.com/rogpeppe/godef.
Cool, all set. But when I try to use C-c C-d in a go file, I get:
Could not run godef binary
I can run it on the command line, and it appears properly defined. What's happening?
I find:
M-x godoc
// then
godoc: OSReadDir // for example
Produces
godoc: /bin/bash: go: command not found
Which suggests to me that even though godef and godoc are found in an ordinary shell, there may be some path issue within emacs? How can I check or fix?
It's this again:
https://askubuntu.com/questions/1045712/emacs-launched-from-favorites-doesnt-read-bashrc
If you launch emacs from the Ubuntu launcher, it doesn't load .bashrc.
You have to open a terminal, and call
$ emacs
The emacs that pops up will have inherited your .bashrc from your shell.