2020-02-23 05:34:35 +00:00
|
|
|
;;; go-init --- The entry point for golang extension
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(defun fg42-go-hook ()
|
2020-02-23 17:56:58 +00:00
|
|
|
"""Setup emacs hooks and turn necessary modes on. """
|
2020-02-23 05:34:35 +00:00
|
|
|
(lsp)
|
2020-02-23 17:56:58 +00:00
|
|
|
(with-ability yas
|
|
|
|
(yas-minor-mode-on))
|
2020-02-23 05:34:35 +00:00
|
|
|
(add-hook 'before-save-hook #'lsp-format-buffer t t)
|
|
|
|
(add-hook 'before-save-hook #'lsp-organize-imports t t)
|
|
|
|
(add-hook 'go-mode-hook 'go-eldoc-setup)
|
|
|
|
(local-set-key (kbd "M-.") #'godef-jump)
|
|
|
|
(local-set-key (kbd "M-*") 'pop-tag-mark))
|
|
|
|
|
|
|
|
|
2020-02-23 14:11:32 +00:00
|
|
|
|
|
|
|
(defun go-path () (concat (getenv "HOME") "/go"))
|
|
|
|
(defun go-path-binary () (concat (go-path) "/bin"))
|
2020-02-23 16:27:37 +00:00
|
|
|
|
2020-02-23 05:34:35 +00:00
|
|
|
(defun extensions/go-initialize ()
|
2020-02-23 14:11:32 +00:00
|
|
|
"""Initialize Golang extension ."""
|
|
|
|
(add-to-list 'exec-path (go-path-binary))
|
2020-02-23 05:34:35 +00:00
|
|
|
(add-hook 'go-mode-hook 'fg42-go-hook))
|
|
|
|
|
|
|
|
(provide 'extensions/go/init)
|
|
|
|
;;; init ends here.
|