diff options
Diffstat (limited to '')
-rw-r--r-- | emacs.d/modules/module-go.el | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/emacs.d/modules/module-go.el b/emacs.d/modules/module-go.el new file mode 100644 index 0000000..19f40db --- /dev/null +++ b/emacs.d/modules/module-go.el @@ -0,0 +1,50 @@ +(require 'config-package) + +(use-package go-mode + :mode (("\\.go\\'" . go-mode)) + :bind ("C-z" . hydra-go/body)) + +(use-package go-eldoc + :config + (add-hook 'go-mode-hook 'go-eldoc-setup)) + +(use-package gotest) + +(use-package go-guru) + +(use-package go-imports) + +(use-package golint) + +(use-package go-projectile) + +(use-package company-go + :config + (add-hook 'go-mode-hook (lambda() (add-to-list 'company-backends 'company-go)))) + +(defun fc/my-go-hook () + (set (make-local-variable 'compile-command) + "go build -v && go test -v && go vet") + (setq-local tab-width 2)) + +(add-hook 'before-save-hook 'gofmt-before-save) +(add-hook 'go-mode-hook 'fc/my-go-hook) +(add-hook 'go-mode-hook 'company-mode) + +(defhydra hydra-go (:hint nil :exit t) +" +^Command^ ^Imports^ ^Doc^ +^-------^------^-------^-------^---^ +_r_: run _ig_: goto _d_: doc at point +_g_: guru _ia_: add +^ ^ _ir_: remove +" + ("g" 'hydra-go-guru/body :color blue) + ("r" go-run-main) + ("d" godoc-at-point) + ("ig" go-goto-imports ) + ("ia" go-import-add) + ("ir" go-remove-unused-imports) + ("q" nil "quit" :color blue)) + +(provide 'module-go) |