The cmd/gorename tool long predates the LSP and gopls, and its functionality has since been subsumed by them. We should deprecate and delete the command, following the sequence used for go/pointer in https://github.com/golang/go/issues/59676.
Example of using gopls as a batch renaming tool:
$ cat a.go
package main
func main() {
f()
}
func f() {}
$ gopls rename -write ./a.go:#42 g
$ cat a.go
package main
func main() {
g()
}
func g() {}
gopls doesn't support the symbolic command-line syntax for choosing the symbol to rename: - https://github.com/golang/go/issues/61627
I wonder how many people actually use it, instead of specifying the symbol by position (e.g. byte offset 42 in the example above).
Comment From: gabyhelp
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: rsc
Based on the discussion above, this proposal seems like a likely accept. — rsc for the proposal review group
The proposal is to tag one last version of x/tools/cmd/gorename (in its own sub-module) and then delete it from the repo. go install
will still work because it will find the old version.
Comment From: gopherbot
No change in consensus, so accepted. 🎉 This issue now tracks the work of implementing the proposal. — aclements for the proposal review group
The proposal is to tag one last version of x/tools/cmd/gorename (in its own sub-module) and then delete it from the repo. go install
will still work because it will find the old version.
Comment From: gopherbot
Change https://go.dev/cl/614158 mentions this issue: cmd/gorename: create submodule
Comment From: gopherbot
Change https://go.dev/cl/614159 mentions this issue: x/tools: remove refs to cmd/gorename
Comment From: gopherbot
Change https://go.dev/cl/614635 mentions this issue: cmd/gorename: remove replace directive
Comment From: gopherbot
Change https://go.dev/cl/614675 mentions this issue: cmd/gorename: delete