summaryrefslogtreecommitdiff
path: root/lang/go.el
diff options
context:
space:
mode:
Diffstat (limited to 'lang/go.el')
-rw-r--r--lang/go.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/lang/go.el b/lang/go.el
index 654b19f..199053d 100644
--- a/lang/go.el
+++ b/lang/go.el
@@ -1,11 +1,15 @@
;;; lang/go.el -*- lexical-binding: t; -*-
-(after! lsp
- (lsp-register-custom-settings
- '(("gopls.staticcheck" t t))))
+(defun +eglot-organize-imports ()
+ (call-interactively 'eglot-code-action-organize-imports))
-(setq-hook! 'go-mode-hook +format-with :none)
+(when (featurep! :tools lsp +eglot)
+ (after! eglot
+ (add-to-list 'eglot-workspace-configuration
+ `((:gopls . ((staticcheck . t))))))
-(add-hook! 'go-mode-hook
- (add-hook 'before-save-hook 'lsp-format-buffer t t)
- (add-hook 'before-save-hook 'lsp-organize-imports t t))
+ (setq-hook! 'go-mode-hook +format-with :none)
+
+ (add-hook! 'go-mode-hook
+ (add-hook 'before-save-hook #'eglot-format-buffer -30 t)
+ (add-hook 'before-save-hook #'+eglot-organize-imports -20 t)))