summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--emacs/custom/my-prog.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/emacs/custom/my-prog.el b/emacs/custom/my-prog.el
index 97eec00..379262f 100644
--- a/emacs/custom/my-prog.el
+++ b/emacs/custom/my-prog.el
@@ -69,6 +69,10 @@
   "Hooks for `go-mode'."
   (setq tab-width 4)
 
+  ;; format the buffer using gofmt, for reasons unclear, doing this
+  ;; with LSP is not working great.
+  (add-hook 'before-save-hook 'gofmt-before-save)
+
   (set (make-local-variable 'compile-command)
        "go build -v && go test -v -cover")
   (define-key go-mode-map (kbd "C-c C-r") 'compile)
@@ -112,9 +116,6 @@
 (dolist (hook '(go-mode-hook nix-mode-hook))
   (add-hook hook 'eglot-ensure))
 
-;; rely on eglot to do the formatting for go buffers
-(add-hook 'go-mode-hook #'(lambda() (add-hook 'before-save-hook 'eglot-format-buffer nil t)))
-
 (provide 'my-prog)
 
 ;;; my-prog.el ends here