gopatch
gopatch copied to clipboard
Add an option to disable automatic code formatting
Currently when you use the following patch:
@@
var x expression
@@
-x.Enabled(true)
+x.Enabled()
This automatically reformats the expression matched to x
, and that could make a lot of unwanted changes. For example, if the original code looks like this:
a.Foo().Bar(bar)
.Baz(baz)
.Enabled(true)
The resulting code after applying the patch becomes a one-liner:
a.Foo().Bar(bar).Baz(baz).Enabled()
Adding an option to disable the automatic formatting of code when applying patches could be nice for cases like this. For example, with that option, the resulting code would look like this:
a.Foo().Bar(bar)
.Baz(baz)
.Enabled()
It is necessary to reduce unnecessary diff generation