Installed vim-go under ~/.vim/bundle via pathogen, when calling :GoDef at some symbol, say net/dial.go:367 (go version go1.10 darwin/amd64) and call :GoDef (or gd, <c-]>), vim-go does not jump to the correct place as expected.
365 case *UDPAddr:
366 la, _ := la.(*UDPAddr)
367 c, err = dialUDP(ctx.network, la, ra, deadline)
vim-go will jump to one of the definitions in udpsock_posix.go or udpsock_plan9.go.
Verified godef behavior, and it is indeed reporting something
$ godef -f dial.go dialUDP
udpsock_plan9.go:123:6
Jump did not occur, and an error message in red is displayed:
vim-go: /Volumes/gitws/digo
Vim version (first two lines from :version):
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 27 2018 17:14:55)
macOS version
Go version (go version):
go version go1.10 darwin/amd64
go env):GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/phye/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Volumes/gitws/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ch/0fcsjfy14kd6jgpzwky0ggvm0000gn/T/go-build289365182=/tmp/go-build -gno-record-gcc-switches -fno-common"
vim-go version:
Commit id: 39beabec0d20d8bd03e1d0e3d38c36029ba209c9
vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):
Only one line:
call pathogen#infect()
What does :messages give you? I think it'll show you a more complete error.
It says info below:
Messages maintainer: Bram Moolenaar <[email protected]>
"dial.go" [readonly] 431L, 13154C
vim-go: searching declaration ...
vim-go: FAILED
vim-go: guru: no object for identifier
vim-go: /usr/local/go/src/net
Does this mean that I need to update/reinstall guru?
Thanks
OK, after running :GoUpdateBinaries to update guru, guru still cannot finish successfully.
Here's the same error message:
vim-go: searching declaration ...
vim-go: FAILED
vim-go: guru: no object for identifier
vim-go: /usr/local/go/src/net
This seems to work as expected on my system.
I'm confused as net/dial.go:367 doesn't contain anything remotely similar to the code you posted on my Go 1.10 installation. There is some similar code on line 550 though. Are you sure you're using the correct sources? Which files are you opening, and are those inside GOROOT or GOPATH?
Also note that :GoDef uses guru by default, not godef. You'll need to use let g:go_def_mode = 'godef' to use godef.
@Carpetsmoker Thanks for investigation!
I've made some silly mistake to mix a go 1.05 installation with a go 1.10 installation, i.e., I'm indeed not using the correct sources... Also, the go std libraries may be in chaos.
After cleaned up the golang environment and freshed installed a new 1.10 go installation, :GoDef works properly now!
Thanks for your help.
Most helpful comment
This seems to work as expected on my system.
I'm confused as
net/dial.go:367doesn't contain anything remotely similar to the code you posted on my Go 1.10 installation. There is some similar code on line 550 though. Are you sure you're using the correct sources? Which files are you opening, and are those inside GOROOT or GOPATH?Also note that
:GoDefusesguruby default, notgodef. You'll need to uselet g:go_def_mode = 'godef'to usegodef.