Coc-go

From wikinotes

neovim LSP server for golang, uses gopls under the hood (although I did not need to install it).

Documentation

github https://github.com/josa42/coc-go
gopls troubleshooting https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md#capturing-logs

Configuration

autoimport, autoformat on save

autocmd BufWritePre *.go
  \ :silent call CocAction('runCommand', 'editor.action.organizeImport')
  \ | :silent call CocAction('runCommand', 'editor.action.formatDocument')

Usage

exec "normal \<Plug>(coc-rename)"  " refactor-rename

Troubleshooting

Hangs on setting up workspace: loading packages...

I believe this is caused by my settings detecting a go project,
before actually entering a go srcfile itself.
solve by restarting coc.

:CocRestart