x/tools/cmd/gorename: rename failure sometimes wipes files clean #31434
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
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?
Inside VS Code, I tried to perform a simple rename which failed for unknown reasons. I know the rename was legal because I was able to do it successfully via Find and Replace (not my preferred method of renaming something). Restoring everything and retrying the rename also works.
The intermittent error is as follows:
Sometimes it shows the below error:
The rename failure resulted in one of the affected files getting its contents wiped clean (the file is now blank).
This issue is highly intermittent and has only happened to me twice so far (although
gorename
failing for unknown reasons without wiping files is more frequent).I have no idea why
gorename
has the potential to completely wipe a file's contents when it can simply leave the file unchanged upon failure.This issue is very infuriating and can set back developers hours in case their most recent changes were not saved somewhere.
What did you expect to see?
I expected one of two things:
The rename should have succeeded because it was perfectly legal.
In case the rename fails, no file should have its contents wiped clean.
What did you see instead?
One of the files affected by the rename had its contents wiped clean upon rename failure.
The text was updated successfully, but these errors were encountered: