I installed the newest doom emacs on macOS. Also configed language packages as

$ emacs ~/.doom.d/init.el
(go +lsp)

$ ~/.emacs.d/bin/doom sync

When I open a .go file, the code became highlight. But after save the file, the code can't been formated automatically. I have installed gofmt and goimports. How to set emacs to use them?

I read this document: lang/go module. It seems it can do it: Auto-formatting on save (gofmt). Maybe because of environment path? So how to call system path from emacs? My GOPATH is ~/go, it set in ~/.zshrc. When I open shell via M+x, something is different from terminal. How to import .zshrc configuration completely?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.