summary refs log tree commit diff
path: root/emacs.d/custom/fcuny-go.el
blob: 75bd04259f26c940666e6b6a1c88130ec55adac0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(use-package go-mode
  :ensure t
  :after (exec-path-from-shell flycheck flyspell)
  :hook (go-mode . fcuny/go-mode-setup)
  :bind (("M-?" . godoc-at-point)
         ("M-." . godef-jump)
         ;; Jump back after godef-jump
         ("M-*" . pop-tag-mark))
  :custom
  (godoc-use-completing-read t)
  ;; see https://github.com/dominikh/go-mode.el/issues/262
  (godoc-at-point-function 'godoc-gogetdoc)
  :init
  (defun fcuny/go-mode-setup ()
    (setq tab-width 4)
    (add-hook 'before-save-hook 'gofmt-before-save))
  :config
  (when (memq window-system '(mac ns))
    (exec-path-from-shell-copy-env "GOPATH")))

(use-package go-guru
  :ensure t
  :after go-mode
  :commands (go-guru-describe go-guru-freevars go-guru-implements go-guru-peers
             go-guru-referrers go-guru-definition go-guru-pointsto
             go-guru-callstack go-guru-whicherrs go-guru-callers go-guru-callees
             go-guru-expand-region)
  :config
  (unless (executable-find "guru")
    (warn "go-mode: couldn't find guru, refactoring commands won't work"))
  (add-hook 'go-mode-hook #'go-guru-hl-identifier-mode))

(use-package go-eldoc
  :ensure t
  :after go-mode
  :config
  (add-hook 'go-mode-hook 'go-eldoc-setup))

(use-package godoctor
  :ensure t
  :after go-mode)

(provide 'fcuny-go)