summary refs log tree commit diff
path: root/emacs.d/modes/lang-go.el
blob: 0b56bd9f9450c419f74dd093b7e7ad830e0d3a26 (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
(when (memq window-system '(mac ns x))
    (dolist (var '("GOPATH" "GO15VENDOREXPERIMENT"))
      (unless (getenv var)
        (exec-path-from-shell-copy-env var))))

(use-package go-mode
  :ensure t
  :defer t
  :config
  (progn
    (bind-key "C-c C-f" 'gofmt go-mode-map)
    (bind-key "C-c h" 'godoc go-mode-map)
    (bind-key "C-c C-g" 'go-goto-imports go-mode-map)
    (bind-key "C-c C-r" 'go-remove-unused-imports go-mode-map))
  :init
  (progn (add-hook 'go-mode-hook (lambda ()
                                   (go-eldoc-setup)
                                   (add-hook 'before-save-hook 'gofmt-before-save)
                                   (set (make-local-variable 'company-backends) '(company-go))))))

(use-package go-eldoc
  :ensure t
  :defer t
  :init (add-hook 'go-mode-hook 'go-eldoc-setup))

(use-package company-go
  :ensure t
  :defer t)

(provide 'lang-go)