Skip to content

Commit

Permalink
go: replace deprecated oracle with guru
Browse files Browse the repository at this point in the history
change to prefix for guru commands from `mr` to `mf`
to separate from rename commands. Better prefix?

Fixes #6772.
  • Loading branch information
edrex committed Aug 5, 2016
1 parent e51a89a commit 0c0e088
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 33 deletions.
32 changes: 16 additions & 16 deletions layers/+lang/go/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
- [[#tests][Tests]]
- [[#working-with-go][Working with Go]]
- [[#go-commands-start-with-m][Go commands (start with =m=):]]
- [[#go-oracle][Go Oracle]]
- [[#go-guru][Go Guru]]

* Description
This layer adds extensive support for go.

** Features:
- gofmt/goimports on file save
- Auto-completion using [[https://github.com/nsf/gocode/tree/master/emacs][go-autocomplete]] (with the =auto-completion= layer)
- Source analysis using [[http://golang.org/s/oracle-user-manual][go-oracle]]
- Source analysis using [[https://godoc.org/golang.org/x/tools/cmd/guru][go-guru]]
- Linting with flycheck's built-in checkers or flycheck-gometalinter
- Coverage profile visualization

Expand All @@ -32,7 +32,7 @@ You will need =gocode= and =godef=:
#+BEGIN_SRC sh
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v golang.org/x/tools/cmd/oracle
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v golang.org/x/tools/cmd/goimports
#+END_SRC
Expand Down Expand Up @@ -119,19 +119,19 @@ The default value is =display-buffer-reuse-window=.
| ~SPC m t t~ | run "go test" for the function you're currently in (while you're in a _.test.go file) |
| ~SPC m t s~ | run "go test" for the suite you're currently in (requires gocheck) |

** Go Oracle
** Go Guru

| Key Binding | Description |
|-------------+------------------------------------------------------------|
| ~SPC m r o~ | go-oracle set analysis scope |
| ~SPC m r <~ | go-oracle show possible callers |
| ~SPC m r >~ | go-oracle show call targets |
| ~SPC m r c~ | go-oracle show channel sends/receives |
| ~SPC m r d~ | go-oracle show definition |
| ~SPC m r f~ | go-oracle show free variables |
| ~SPC m r g~ | go-oracle show callgraph |
| ~SPC m r i~ | go-oracle show implements relation |
| ~SPC m r p~ | go-oracle show what the select expression points to |
| ~SPC m r r~ | go-oracle show all references to object |
| ~SPC m r s~ | go-oracle show callstack |
| ~SPC m r t~ | go-oracle describe selected syntax, kind, type and methods |
| ~SPC m f o~ | go-guru set analysis scope |
| ~SPC m f <~ | go-guru show possible callers |
| ~SPC m f >~ | go-guru show call targets |
| ~SPC m f c~ | go-guru show channel sends/receives |
| ~SPC m f d~ | go-guru show definition |
| ~SPC m f f~ | go-guru show free variables |
| ~SPC m f g~ | go-guru show callgraph |
| ~SPC m f i~ | go-guru show implements relation |
| ~SPC m f p~ | go-guru show what the select expression points to |
| ~SPC m f r~ | go-guru show all references to object |
| ~SPC m f s~ | go-guru show callstack |
| ~SPC m f t~ | go-guru describe selected syntax, kind, type and methods |
1 change: 1 addition & 0 deletions layers/+lang/go/local/gotest
Submodule gotest added at 8e91d4
35 changes: 18 additions & 17 deletions layers/+lang/go/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
helm-gtags
go-eldoc
go-mode
(go-oracle :location site)
(go-guru :location site)
(go-rename :location local)
))

Expand Down Expand Up @@ -113,31 +113,32 @@
(defun go/init-go-eldoc()
(add-hook 'go-mode-hook 'go-eldoc-setup))

(defun go/init-go-oracle()
(defun go/init-go-guru()
(let ((go-path (getenv "GOPATH")))
(if (not go-path)
(spacemacs-buffer/warning
"GOPATH variable not found, go-oracle configuration skipped.")
"GOPATH variable not found, go-guru configuration skipped.")
(when (load-gopath-file
go-path "/src/golang.org/x/tools/cmd/oracle/oracle.el")
(spacemacs/declare-prefix-for-mode 'go-mode "mr" "rename")
go-path "/src/golang.org/x/tools/cmd/guru/go-guru.el")
(spacemacs/declare-prefix-for-mode 'go-mode "mf" "guru")
(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)))))
"fd" 'go-guru-describe
"ff" 'go-guru-freevars
"fi" 'go-guru-implements
"fc" 'go-guru-peers
"fr" 'go-guru-referrers
"fj" 'go-guru-definition
"fp" 'go-guru-pointsto
"fs" 'go-guru-callstack
"fe" 'go-guru-whicherrs
"f<" 'go-guru-callers
"f>" 'go-guru-callees
"fo" 'go-guru-set-scope)))))

(defun go/init-go-rename()
(use-package go-rename
:init
(spacemacs/declare-prefix-for-mode 'go-mode "mr" "rename")
(spacemacs/set-leader-keys-for-major-mode 'go-mode "rn" 'go-rename)))

(defun go/init-flycheck-gometalinter()
Expand Down

0 comments on commit 0c0e088

Please sign in to comment.