gopatch icon indicating copy to clipboard operation
gopatch copied to clipboard

Refactoring and code transformation tool for Go.

Results 33 gopatch issues
Sort by recently updated
recently updated
newest added

Functionality to list matches without modifying the target files. User comments could be caught during the linting phase instead of their manual detection during the code review process. For example:...

`[...]` in function calls should match any and all generic function instantiations. ```diff @@ @@ -foo[...](42) +bar[...](42) ``` Should match: ``` foo(42) foo[int](42) foo[MyInt](42) ```

enhancement

Elision does not seem to match variadic parameters - which also use the `...` notation. Below is a simple repro. Patch file (goal is to swap order of first 2...

For gopatch, currently the following are different: ``` var foo = 42 var ( foo = 42 ) ``` gopatch should understand decl groupings for types, consts, vars, and funcs...

enhancement

We should support metavariables to match on literals. That is, to match on `"foo"` and `42` below. ``` x := "foo" const y = 42 ``` This will make it...

enhancement

It's currently impossible to have a patch that introduces a new top-level declaration while modifying another one. For example, given, ``` func foo() { re := regexp.MustCompile("foo") // ... }...

enhancement

We should support a `-d` flag to print the diff of what would be changed without changing anything. If the diff was non-empty, the program would exit with a non-zero...

enhancement

We should support a `-l` flag to list matches of a patch without changing anything. This could be used to implement simple linters.

enhancement

For simple, short patches, we should support a `-e` flag like sed with some automatic means of defining metavariables similar to `gofmt -r`.

enhancement

Patches currently apply at matching "levels" in the AST. For example, consider the following patch. ```diff @@ @@ -func foo(...) { +func foo(...) error { ... if err != nil...

enhancement