Go: replacing gofmt with gofumpt when using lsp-mode

gofumpt is a better gofmt, with more strictures, that match my personal taste.

It is available at the AUR for Arch linux users as gofumpt.

Add this to your ~/.config/doom/config.el to instruct lsp-mode to use it.

;; https://pkg.go.dev/mvdan.cc/gofumpt
;; https://github.com/emacs-lsp/lsp-mode/blob/8f9259af6fc80a609c2c068d0f59c371205aca89/clients/lsp-go.el#L246
(setq lsp-go-use-gofumpt t)
Code Snippet 1: ~/.config/doom/config.el

It is directly supported by gopls, it just need to be told to use it.

Tags doom emacs lsp go
pancho horrillo
I do things with computers.