   :defer t
   :commands gofmt
   :init
-  (defun seanmacs/gofmt-before-save ()
-    (when (eq major-mode 'go-mode)
-      (gofmt)))
+  (defun sm/set-gofmt-hook ()
+    (add-hook 'before-save-hook #'gofmt nil t))
   :config
   (setq gofmt-command "goimports"
         gofmt-args '("-local=coder.com,cdr.dev,go.coder.com,github.com/cdr"))

  (sm/set-goto-def-keybind 'elixir-mode-map #'lsp-find-definition)

  :hook ((elixir-mode . lsp)
         (before-save . sm/elixir-format-on-save))
  :bind(:map elixir-mode-map
             ("C-c C-d" . lsp-describe-thing-at-point)
             ("C-c r r" . lsp-rename)

    (flycheck-remove-next-checker 'lsp 'golangci-lint))

  :hook ((go-mode . lsp)
         (go-mode . sm/set-gofmt-hook))
  :bind(:map go-mode-map
             ("C-c C-d" . lsp-describe-thing-at-point)
             ("C-c r r" . lsp-rename)))
