2015-04-19 03:57:27 +00:00
|
|
|
(setq go-pre-extensions
|
2015-01-12 04:22:23 +00:00
|
|
|
'(
|
|
|
|
;; pre extension gos go here
|
2015-04-19 03:40:24 +00:00
|
|
|
))
|
2015-01-12 04:22:23 +00:00
|
|
|
|
2015-04-19 03:57:27 +00:00
|
|
|
(setq go-post-extensions
|
2015-01-12 04:22:23 +00:00
|
|
|
'(
|
|
|
|
;; post extension gos go here
|
|
|
|
go-oracle
|
2015-02-07 01:03:40 +00:00
|
|
|
go-rename
|
2015-04-19 03:40:24 +00:00
|
|
|
))
|
2015-01-12 04:22:23 +00:00
|
|
|
|
|
|
|
;; For each extension, define a function go/init-<extension-go>
|
|
|
|
;;
|
|
|
|
;; (defun go/init-my-extension ()
|
|
|
|
;; "Initialize my extension"
|
|
|
|
;; )
|
|
|
|
;;
|
|
|
|
;; Often the body of an initialize function uses `use-package'
|
|
|
|
;; For more info on `use-package', see readme:
|
|
|
|
;; https://github.com/jwiegley/use-package
|
|
|
|
|
2015-02-15 15:53:03 +00:00
|
|
|
(defun load-gopath-file(gopath name)
|
|
|
|
"Search for NAME file in all paths referenced in GOPATH."
|
2015-08-23 01:47:30 +00:00
|
|
|
(let* ((sep (if (spacemacs/system-is-mswindows) ";" ":"))
|
2015-08-14 02:54:52 +00:00
|
|
|
(paths (split-string gopath sep))
|
|
|
|
found)
|
2015-03-12 04:36:09 +00:00
|
|
|
(loop for p in paths
|
|
|
|
for file = (concat p name) when (file-exists-p file)
|
|
|
|
do
|
|
|
|
(load-file file)
|
|
|
|
(setq found t)
|
|
|
|
finally return found)))
|
2015-02-15 15:53:03 +00:00
|
|
|
|
2015-01-12 04:22:23 +00:00
|
|
|
(defun go/init-go-oracle()
|
2015-02-15 03:44:06 +00:00
|
|
|
(let ((go-path (getenv "GOPATH")))
|
|
|
|
(if (not go-path)
|
2015-04-12 16:25:53 +00:00
|
|
|
(spacemacs-buffer/warning
|
|
|
|
"GOPATH variable not found, go-oracle configuration skipped.")
|
2015-03-12 04:36:09 +00:00
|
|
|
(when (load-gopath-file
|
2015-04-02 18:59:43 +00:00
|
|
|
go-path "/src/golang.org/x/tools/cmd/oracle/oracle.el")
|
2015-11-27 20:35:24 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'go-mode "mr" "rename")
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'go-mode
|
|
|
|
"ro" 'go-oracle-set-scope
|
|
|
|
"r<" 'go-oracle-callers
|
|
|
|
"r>" 'go-oracle-callees
|
|
|
|
"rc" 'go-oracle-peers
|
|
|
|
"rd" 'go-oracle-definition
|
|
|
|
"rf" 'go-oracle-freevars
|
|
|
|
"rg" 'go-oracle-callgraph
|
|
|
|
"ri" 'go-oracle-implements
|
|
|
|
"rp" 'go-oracle-pointsto
|
|
|
|
"rr" 'go-oracle-referrers
|
|
|
|
"rs" 'go-oracle-callstack
|
|
|
|
"rt" 'go-oracle-describe)))))
|
2015-02-07 01:03:40 +00:00
|
|
|
|
|
|
|
(defun go/init-go-rename()
|
2015-02-08 04:26:27 +00:00
|
|
|
(use-package go-rename
|
|
|
|
:init
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'go-mode "rn" 'go-rename)))
|