I have a file work.go opened in vim-go. It's in package oldpackagename.
I want to refactor and rename it to newpackagename. Is there some tooling for that? The reason is, the initial assumptions for oldpackagename do not apply anymore.
I know I can do search and replace stuff, but usually either
GoRename resp.nmap <leader>rn <Plug>(coc-rename)work just fine on automatically renaming all occurrences.
But for the package name, I get:
vim-go: [rename] SUCCESS vim-go: cannot rename the identifier at the requested position for
GoRenameand:
[coc.nvim] Error on rename: The element can't be renamed. for
coc.nvim.
Is package renaming different? Do I have to use search/replace or are my configs maybe corrupted?
Under the hood, vim-go uses either gorename or gopls to run :GoRename; the default is now gopls.
Both of these don't support renaming packages:
gopls to support package renaminggorename source codeFor coc.nvim, I'm not sure, but it seems to integrate with gopls, so the same lack of support would apply.