SpacemacsでGolangの環境を整える
Getting Startedに従ってGolang langをインストールする
SpacemacsのdevelopブランチでGolang layerとLSP layerをインストールする
Golang layer https://github.com/syl20bnr/spacemacs/blob/develop/layers/%2Blang/go/README.org
https://github.com/syl20bnr/spacemacs/tree/develop/layers/+checkers/syntax-checking
https://github.com/syl20bnr/spacemacs/tree/develop/layers/+completion/auto-completion
LSP layer https://github.com/syl20bnr/spacemacs/blob/develop/layers/%2Btools/lsp/README.org
goplsをインストールした
プチハマりポイントとしてはLSP modeのワークスペースを適切に設定しないといけなかった
バージョン管理のリポジトリルートとプロジェクトのルートが異なるときは注意
lsp-workspace-folders-addコマンドを実行して適切に設定すれば問題ない
Golang layerとしてはひとまず以下だけを設定している
code:.spacemacs.el
(go :variables
go-backend 'lsp
go-tab-width 4
go-format-before-save t)
これでIntellij IDEAと遜色ない程度の補完機能などが手に入った