See: - https://github.com/golang/go/issues/69582
Comment From: gabyhelp
Related Issues and Documentation
- x/tools/gopls: allow renaming arbitrary package paths #57171
- x/tools/gopls: improvements to package renaming #56184 (closed)
- x/tools/gopls: rename package decl fails in CLI (and is undocumented) #69582
- x/tools/gopls: support renaming a package #41567 (closed)
- x/tools/gopls: implement references on package names #52968 (closed)
- x/tools/gopls: support module-local renaming #32877 (closed)
- x/tools/cmd/gorename: tag and delete it #69360 (closed)
- x/tools/gopls: changing package names returns an error #32149 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: adonovan
Renaming a package declaration only appears to work within the same grandparent directory (e,g. package a
-> package b
). We should support renamings to arbitrary new directories (e.g. a
-> ../c
or example.com/d
).
See also: - https://github.com/golang/go/issues/40341#issuecomment-1230741206