Open ccoVeille opened 5 days ago
Please note that
@@
var f identifier
@@
-func f(t *testing.T) {
+func f(t *testing.T) {
+ t.Helper()
+
+ t.Helper()
...
}
will rewrite this
func myTestHelper(t *testing) {
require.Fail(t)
}
to
func myTestHelper(t *testing) {
t.Helper()
t.Helper()
require.Fail(t)
}
So no line feed
Once again, please note it's pseudo code
Hey @ccoVeille. gopatch is limited in that aspect: it only transforms significant AST nodes. It could probably do something smarter about them, but the original design left out comments and newlines with more focus on just transforming code.
I was thinking about using the tool to add //nolint somelinter // reason
on some pattern I have in my code base.
I would love if comment could be supported.
I would prefer if it was possible, but I can leave without new lines.
Comment is a bit more painful
I'm trying to use patch to perform something like this
This code is part of a bigger patch and code reorganization. So this is a code to replicate the issue/question I want to talk about.
My issues right now are that:
I would like to know if I'm not missing something obvious