-
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: fails due DO NOT EDIT comment #28175
Comments
To rename something in a generated file one changes the generator. I don't see why gorename should ever touch generated files, quite the opposite. This is IMO working as intended. |
Even if it is the way it supposed to work - I like that gorename stays on the safe side - it can break a flow when somebody wants to change declaration that happens outside of "DO NOT EDIT" files. But do people usually get stumbled onto this often? @anjmao can you describe exactly how did you use gorename and did you find the fix for this situation at all? |
Offtopic note. It seems to me that gorename does not receive much love recently. Is it because it's not widely used tool or just authors has shifted their attention?.. I wonder if gorename is used only within emacs and vim. |
@ysmolsky Solution is simple, remove DO NOT EDIT comment in generated file. |
@anjmao I think you are after:
As you say, |
It's not possible to rename using gorename if I have generated mock files. I can make it work only by manually removing
DO NOT EDIT
comment from generated file.I see there is this logic
There is -force flag which is a bit scary and I don't want to break my program.
Would be great to have some flag like
-report-conflicts
which returns conflicts so editors can visually show conflicts. Eg. Gogland is doing the same, if there are conflicts it allows you to mark files and force rename.What version of Go are you using (
go version
)?All versions
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?All
What did you do?
storage.go
What did you expect to see?
Rename to work normally
What did you see instead?
Because generated gomock file contains
DO NOT EDIT
I getrefusing to modify generated file%s containing DO NOT EDIT marker
The text was updated successfully, but these errors were encountered: