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
GoRenameresp.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
gorenameorgoplsto run:GoRename; the default is nowgopls.Both of these don't support renaming packages:
goplsto support package renaminggorenamesource codeFor coc.nvim, I'm not sure, but it seems to integrate with
gopls, so the same lack of support would apply.