summaryrefslogtreecommitdiff
path: root/emacs/init.el
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2022-09-17 12:24:29 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2022-09-17 12:24:29 +0100
commitb05b52881207b134c6ab08710ae55ac421faea9b (patch)
tree8b1ac5783f0523f5ef8b68a6a69ab38e72f50c36 /emacs/init.el
parentfa7c95b200c3778a9e94afb77ed67c526dd13f3a (diff)
emacs: Use Eglot with Go
Diffstat (limited to 'emacs/init.el')
-rw-r--r--emacs/init.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/emacs/init.el b/emacs/init.el
index 9c5f5c7..741c6f8 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -145,8 +145,11 @@
(my/with-add-hook 'go-mode-hook
(setq tab-width 2)
- (add-hook 'before-save-hook #'gofmt-before-save nil :local)
- (flycheck-mode))
+
+ (when (executable-find "gopls")
+ (eglot-ensure)
+ (add-hook 'before-save-hook #'my/eglot-organize-imports nil :local)
+ (add-hook 'before-save-hook #'eglot-format-buffer nil :local)))
;; Flycheck