From b05b52881207b134c6ab08710ae55ac421faea9b Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sat, 17 Sep 2022 12:24:29 +0100 Subject: emacs: Use Eglot with Go --- emacs/init.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'emacs/init.el') 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 -- cgit v1.2.3-70-g09d2