refactor godef error handling
refactor godef error handling

split out error checks and error reporting so that other functions can
reuse them.

artemave/go-mode.el,ibukanov/go-mode.el,tjyang/go-mode.el,codemac/go-mode.el,gorakhargosh/go-mode.el,emacsmirror/go-mode,dominikh/go-mode.el,kimiby/go-mode.el,magastzheng/go-mode.el