Created
July 8, 2023 07:42
-
-
Save qxxt/9775c587db0930d883dd7a2f6b44f9a8 to your computer and use it in GitHub Desktop.
Simple hack for calling goimports on buffer on Emacs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun goimports-buffer () | |
"Format current buffer with goimports." | |
(interactive) | |
(let ((gofmt-command-bak gofmt-command) | |
(gofmt-args-bak gofmt-args)) | |
(setq gofmt-command "goimports" | |
gofmt-args nil) | |
(with-current-buffer (current-buffer) | |
(gofmt)) | |
(setq gofmt-command gofmt-command-bak | |
gofmt-args gofmt-args-bak))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment