blob: f2e9443728a4fef142f36f6976b84ba2663a4043 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
;; go tools that are needed:
;; go get -u github.com/mdempsky/gocode
;; go get -u github.com/rogpeppe/godef
;; go get -u golang.org/x/tools/cmd/gopls
;; go get -u golang.org/x/tools/cmd/goimports
;; go get -u golang.org/x/tools/cmd/gorename
;; go get -u golang.org/x/tools/cmd/gotype
;; go get -u golang.org/x/tools/cmd/godoc
;; go get -u github.com/go-delve/delve/cmd/dlv
;; go get -u github.com/josharian/impl
;; go get -u github.com/cweill/gotests/...
;; go get -u github.com/fatih/gomodifytags
;; go get -u github.com/davidrjenni/reftools/cmd/fillstruct
;; go get -u github.com/uudashr/gopkgs/cmd/gopkgs
;; go get -u onnef.co/go/tools/...
(use-package go-mode
:ensure t
:after (exec-path-from-shell flycheck flyspell company company-go hydra)
:hook ((go-mode . fcuny/go-mode-setup)
(go-mode . company-mode))
:custom
(godoc-use-completing-read t)
(gofmt-command "goimports")
;; 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)
(setq comment-auto-fill-only-comments t)
(setq fill-column 80)
(auto-fill-mode 1)
(add-hook 'before-save-hook 'gofmt-before-save))
:config
(when (memq window-system '(mac ns))
(exec-path-from-shell-copy-env "GOPATH"))
(defhydra hydra-go-menu (:columns 2)
"
^find ^ ^goto ^ ^test^
^-----------^ ^--------^ ^----^
_r_: referrers _d_: definition _T_: test current test
_i_: implements _a_: arguments _F_: test current file
_D_: describe _f_: function _P_: test current package
_R_: return
"
("r" go-guru-referrers)
("i" go-guru-implements)
("D" go-guru-describe)
("d" go-guru-definition)
("a" go-goto-arguments)
("f" go-goto-function)
("R" go-goto-return-values)
("T" go-test-current-test)
("F" go-test-current-file)
("P" go-test-current-project)
("q" nil "quit" :color blue))
(define-key go-mode-map (kbd "C-c g") 'hydra-go-menu/body))
(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)
(use-package gotest :ensure t :after go-mode)
(use-package company-go
:ensure t
:after (company)
:hook (go-mode . (lambda ()
(setq-local company-backends
(append (list 'company-go) company-backends)))))
(provide 'fcuny-go)
|