godef
godef copied to clipboard
cannot find definition of code in vendor directory
- create
main.goin gopath
package main
import (
"go.uber.org/zap"
)
func main() {
logger, _ := zap.NewProduction()
defer logger.Sync()
logger.Info("haha")
}
-
run
dep ensure -add "go.uber.org/zap" -
use vim, open
main.go, jump to line 11, underInfooflogger.Info, and run:YcmCompleter GoTo, gotRuntimeError: Can't find a definition. -
ycmd says:
RuntimeError: Command godef -i -f=main.go -json -o=126 failed with code 2 and error "godef: no declaration found for logger.Info". -
run it in command:
$ godef -i -f=main.go -o=126 < main.go
parseLocalPackage error: no more package files found
godef: no declaration found for logger.Info
ref: https://github.com/Valloric/YouCompleteMe/issues/2985#issuecomment-381327712