branch: elpa/go-mode
commit 9fde5fbcf4c40567cf9e807863be0809f928ecc8
Author: Dominik Honnef <[email protected]>
Commit: Dominik Honnef <[email protected]>
godef-jump: support jumping to package directories
the newest version of godef will emit a package's source directory if
point is on an import statement
---
go-mode.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/go-mode.el b/go-mode.el
index 54b8ef3..4b4829d 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -958,7 +958,8 @@ will be commented, otherwise they will be removed
completely."
"Given a file name in the format of `filename:line:column',
visit FILENAME and go to line LINE and column COLUMN."
(if (not (string-match "\\(.+\\):\\([0-9]+\\):\\([0-9]+\\)" specifier))
- (error "Unexpected godef output: %s" specifier)
+ ;; We've only been given a directory name
+ (funcall (if other-window 'find-file-other-window 'find-file) specifier)
(let ((filename (match-string 1 specifier))
(line (string-to-number (match-string 2 specifier)))
(column (string-to-number (match-string 3 specifier))))
@@ -1016,6 +1017,8 @@ description at POINT."
(message "%s" file))
((go--string-prefix-p "godef: no declaration found for " file)
(message "%s" file))
+ ((go--string-prefix-p "error finding import path for " file)
+ (message "%s" file))
(t
(push-mark)
(ring-insert find-tag-marker-ring (point-marker))