go-parsefix
go-parsefix copied to clipboard
Fixes simple parse errors automatically. Works great in combination with goimports.
```go func f() a, b { } => func f() (a, b) { } ```
Migrated from https://github.com/quasilyte/go-parsefix/issues/13#issuecomment-559782100. Post-validation of the output for syntax correctness can prevent a wrong fixing.
```go // given type Category struct { Repo Branch string } // expected type Category struct { Repo, Branch string } // fixed type Category struct { Repo Branch ;string...
```go // given Article{Category category} // expected Article{Category: category} // fixed Article{Category ,category} ```
```diff - *x := 1 + x := 1 ```
```diff - if x = 10 { + if x == 10 { ```
Code like this breaks everything: ```go func f() { d := // This line } ``` Could try to fix it. The simplest way is to probably insert the operand...
In addition to in-place and stdout mode, add diff mode that prints the diff to the stdout.