misc/emacs/go-mode.el | 6 ++++++ diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el index feba035ee50c91e4ef8f2274ba5f030972e4b091..47d790db41745fbd1f4e27733f4f933e3b2f12d2 100644 --- a/misc/emacs/go-mode.el +++ b/misc/emacs/go-mode.el @@ -470,3 +470,9 @@ (require 'go-mode) (go-mode)) (provide 'go-mode) + +(defun gofmt () + "Pipe the current buffer through the external tool `gofmt`." + + (interactive) + (shell-command-on-region 1 (+ (buffer-size) 1) "gofmt" t t shell-command-default-error-buffer))