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-03-12 04:36:09 +00:00
|
|
|
(let ((paths (split-string gopath ":"))
|
|
|
|
found)
|
|
|
|
(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-03-12 04:36:09 +00:00
|
|
|
(evil-leader/set-key-for-mode 'go-mode
|
|
|
|
"moo" 'go-oracle-set-scope
|
|
|
|
"mo<" 'go-oracle-callers
|
|
|
|
"mo>" 'go-oracle-callees
|
|
|
|
"moc" 'go-oracle-peers
|
|
|
|
"mod" 'go-oracle-definition
|
|
|
|
"mof" 'go-oracle-freevars
|
|
|
|
"mog" 'go-oracle-callgraph
|
|
|
|
"moi" 'go-oracle-implements
|
|
|
|
"mop" 'go-oracle-pointsto
|
|
|
|
"mor" 'go-oracle-referrers
|
|
|
|
"mos" 'go-oracle-callstack
|
|
|
|
"mot" '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
|
|
|
|
(evil-leader/set-key-for-mode 'go-mode "mr" 'go-rename)))
|