golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.96k stars 17.66k forks source link

x/tools/cmd/gorename: tag and delete it #69360

Closed adonovan closed 1 month ago

adonovan commented 1 month ago

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:

I wonder how many people actually use it, instead of specifying the symbol by position (e.g. byte offset 42 in the example above).

gabyhelp commented 1 month ago

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

rsc commented 1 month ago

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.

gopherbot commented 1 month ago

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.

gopherbot commented 1 month ago

Change https://go.dev/cl/614158 mentions this issue: cmd/gorename: create submodule

gopherbot commented 1 month ago

Change https://go.dev/cl/614159 mentions this issue: x/tools: remove refs to cmd/gorename

gopherbot commented 1 month ago

Change https://go.dev/cl/614635 mentions this issue: cmd/gorename: remove replace directive

gopherbot commented 1 month ago

Change https://go.dev/cl/614675 mentions this issue: cmd/gorename: delete