In the video (May 2019), Rebecca points out that gopls is still in alpha and warns us to proceed with caution. Currently, (December 2019) it feels more like a beta, so not too bad, but still not perfect. gopls is, however, the future for Emacs to become a solid Golang editor. This is because it’s the only language tool (beside’s Rebecca’s gocode that’s in maintenance mode) that fully supports Go modules that is in active development.

All I had to do to install it was this:

go get golang.org/x/tools/gopls@latest

It’s important to check out the latest version since the tool is evolving quite quickly right now.

What happens in the editor is that Emacs spawns an instance of the server when go-mode is enabled on a buffer. After this, lsp-mode will attempt to connect to it. The advantage of using a server rather than a command is that it’s much quicker to respond and interface with Emacs (it does feel snappier once the server comes up, which is also fairly quick). The disadvantages are the security concerns of running a server on a laptop; but to be fair, this is not supposed to be a long-running/permanent process.

On my Emacs config, I just added the following lines:

(setq lsp-gopls-staticcheck t) (setq lsp-eldoc-render-all t) (setq lsp-gopls-complete-unimported t)

I just wanted those elements to be active, but feel free to edit to taste.