This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/go/extensions.el

61 lines
1.8 KiB
EmacsLisp
Raw Normal View History

(setq go-pre-extensions
'(
;; pre extension gos go here
))
(setq go-post-extensions
'(
;; post extension gos go here
go-oracle
go-rename
))
;; 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
(defun load-gopath-file(gopath name)
"Search for NAME file in all paths referenced in GOPATH."
(let* ((sep (if (spacemacs/system-is-mswindows) ";" ":"))
2015-08-14 02:54:52 +00:00
(paths (split-string gopath sep))
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)))
(defun go/init-go-oracle()
(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.")
(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")
(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)))))
(defun go/init-go-rename()
2015-02-08 04:26:27 +00:00
(use-package go-rename
:init
(spacemacs/set-leader-keys-for-major-mode 'go-mode "rn" 'go-rename)))