go-search-replace
go-search-replace copied to clipboard
Correctly handle lengths of serialized strings
This introduces an alternate approach to handling serialized strings.
Previously, we were running a search-replace per line and then attempting to fix the lengths of any serialized strings we found. This could be problematic in various contexts including when the serialized string contains an closing string delimiter (see #33).
In this PR, we handle each serialized string chunk separately by extracting the string based on the serialized string length and then running search-replace within that chunk, updating the length, and then replacing in place.
The approach is slower but addresses several bugs and edge cases.
Next:
- [ ] Clean up the PR (remove debug statements)
- [ ] Handle edge cases like out-of-boundary errors
- [ ] Test, benchmark, and share the changes
- [ ] Package and ship