- Don’t forget to uncomment
go
ininit.el
- Enable
lsp
under:tools
and changego
to(go +lsp)
if you’re planning to use a Language Protocol Server using lsp-mode. - Enable
syntax
under:checkers
if you’re planning to use golangci-lint as your linter via flycheck. I recommend that you set golangci-lint as the next flychecker after LSP. - Enable
(web +html)
under:lang
, this will install web-mode. To use it for your Go templates, first enable web modeweb-mode
, then doM-x web-mode-set-engine
and choose go. - Enable
(format +onsave)
under:editor
to rungofmt
on each save
- Enable
- Run
doom doctor
and look inside the:lang go
section to see what executables you lack and install them.
- First see LSP part of the main file and figure out how they are used in go-mode. For example:
- Running
go run file.go
corresponds toSPC c e
- Running
go fmt file.go
corresponds toSPC c f
- Running
C-c C-g
orM-x gorepl-run
to open a go repl on top of gore.C-c C-e
orM-x gorepl-eval-region
to evaluate the selected region.
SPC m t a
to run all existing testsSPC m t b a
to run all existing benchmarksSPC m t G
to write tests for all functions using gotestsSPC m t g
to write tests for selected functions using gotests
M-x
(or equivalently)SPC :
with:go-play-buffer
to send selected buffer to the Playgroundgo-play-region
to send selected region to the Playgroundgo-download-play
to download from the Playground