-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/cmd/gorename: does not work on public functions and structs #30617
Comments
I think this is a pretty serious issue because using Find And Replace can have unexpected results even with "Match Whole Word" and "Match Case" turned on. |
UPDATE: This issue is more serious than I thought because it seems to happen even for public Structs. Gorename does not rename their usages in other packages. |
@ianthehat, what's the word on |
Change https://golang.org/cl/170863 mentions this issue: |
At this point gorename does what it does and we have no plans to make it do anything more. If there were actually a critical bug, we might fix it, but we don't plan to make gorename work in module mode, and we don't plan to add more features. |
@ianthehat So golang basically had an unfinished rename tool right from the start? That's kinda sad to learn. :( >This counts as a feature request (expanding the scope of its rename powers) not a bug. It was always a best effort tool that may take manual clean up when finished. In any case, seeing as how the Go team is now focusing on the new gopls tool, I wish you all the best of luck with it and hope that you awesome guys can at least make it work like a standard renaming tool and not a best effort one. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
My sample project has a package called
mypkg
. Insidemypkg
is a file calledutil.go
.util.go:
Function
TwoPlusTwo()
is used inmain.go
.main.go:
I then renamed
TwoPlusTwo()
toGetTwoPlusTwo()
.What did you expect to see?
I expected
TwoPlusTwo()
to be renamed toGetTwoPlusTwo()
in all its usages.What did you see instead?
Function
TwoPlusTwo()
only got renamed toGetTwoPlusTwo()
insidemypkg
.It stayed as
TwoPlusTwo()
inmain.go
, which now triggers a compiler error because it can't find the function.UPDATE: This issue is more serious than I thought because it seems to happen even for public Structs. Gorename does not rename their usages in other packages.
The text was updated successfully, but these errors were encountered: