This question is on the back of this GitHub issue, when executing godef-jump
on code on some named imports (but not all), it fails with the error that godef: no declaration found for <the gx.thing we're godef-jump'ing>
.
Basically I'm a bit stuck with where to go next in my debugging. I've changed the code in go-mode.el
to use the -debug
flag with godef
, and the outputs are different, from CLI is successful like this:
$ godef -f main.go gx.GetPackageRoot
/home/tomato/ipfs/src/github.com/whyrusleeping/gx/gxutil/pm.go:50:6
Whereas in Emacs it fails with the godef: no declaration found for <the gx.thing we're godef-jump'ing>
error.
With the debug flag enabled, CLI:
$ godef -debug -t -f /home/tomato/ipfs/src/github.com/whyrusleeping/gx/main.go -o 565
2017/06/20 13:29:14 exprType tuple:false pkg: *ast.SelectorExpr gx.GetPackageRoot [
2017/06/20 13:29:14 exprType tuple:false pkg: *ast.Ident gx [
2017/06/20 13:29:14 exprType tuple:false pkg: *ast.ImportSpec gx "github.com/whyrusleeping/gx/gxutil" [
2017/06/20 13:29:14 ] -> 0x0, Type{package "" *ast.ImportSpec gx "github.com/whyrusleeping/gx/gxutil"}
2017/06/20 13:29:14 ] -> 0xc420276140, Type{package "" *ast.ImportSpec gx "github.com/whyrusleeping/gx/gxutil"}
2017/06/20 13:29:14 member Type{package "" *ast.ImportSpec gx "github.com/whyrusleeping/gx/gxutil"} 'GetPackageRoot' {
2017/06/20 13:29:14 } -> &{func GetPackageRoot 0xc4203ac3f0 <nil> <nil>}
2017/06/20 13:29:14 exprType tuple:false pkg: *ast.Ident GetPackageRoot [
2017/06/20 13:29:14 exprType tuple:false pkg: *ast.FuncType func() (string, error) [
2017/06/20 13:29:14 ] -> 0x0, Type{type "" *ast.FuncType func() (string, error)}
2017/06/20 13:29:14 ] -> 0xc420138140, Type{func "" *ast.FuncType func() (string, error)}
2017/06/20 13:29:14 ] -> 0xc420138140, Type{func "github.com/whyrusleeping/gx/gxutil" *ast.FuncType func() (string, error)}
/home/tomato/ipfs/src/github.com/whyrusleeping/gx/gxutil/pm.go:50:6
GetPackageRoot func() (string, error)
Emacs:
2017/06/20 13:31:18 exprType tuple:false pkg: *ast.SelectorExpr gx.GetPackageRoot [
2017/06/20 13:31:18 exprType tuple:false pkg: *ast.Ident gx [
2017/06/20 13:31:18 exprType tuple:false pkg: *ast.ImportSpec gx "github.com/whyrusleeping/gx/gxutil" [
2017/06/20 13:31:18 ] -> 0x0, Type{package "" *ast.ImportSpec gx "github.com/whyrusleeping/gx/gxutil"}
2017/06/20 13:31:18 ] -> 0xc4201fde50, Type{package "" *ast.ImportSpec gx "github.com/whyrusleeping/gx/gxutil"}
2017/06/20 13:31:18 member Type{package "" *ast.ImportSpec gx "github.com/whyrusleeping/gx/gxutil"} 'GetPackageRoot' {
2017/06/20 13:31:18 } -> <nil>
2017/06/20 13:31:18 ] -> 0x0, Type{bad "" <nil> }
godef: no declaration found for gx.GetPackageRoot
I've used strace
to confirm that the expected binary is being called with the expected flags.
I guess the next thing I should do is find out where/how this 2017/06/20 13:29:14 member Type{package "" *ast.ImportSpec gx "github.com/whyrusleeping/gx/gxutil"} 'GetPackageRoot' {
line of output from the debugs is, since it is the next line of debug that differs, but maybe somebody has some better ideas or can already see what's going on here.