Skip to content

Instantly share code, notes, and snippets.

@ocidenttal
Created August 29, 2021 21:32
Show Gist options
  • Save ocidenttal/dd5f6e6c14cf6fe9e5beced3e61014e4 to your computer and use it in GitHub Desktop.
Save ocidenttal/dd5f6e6c14cf6fe9e5beced3e61014e4 to your computer and use it in GitHub Desktop.
This solves the error message raised by coc.nvim with gopls language server when the imports are already organized.
" instead of this
" (this will send error messages to your vim/neovim everytime you save a .go file
" and the imports are already organized)
autocmd! BufWritePre *.go :call CocAction('runCommand', 'editor.action.organizeImport')
" use the `silent` command before `call`
autocmd BufWritePre *.go :silent call CocAction('runCommand', 'editor.action.organizeImport')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment