internal/cmd/avogen: write output file even when gofmt fails (#165)

This makes it easier to debug avogen: when you emit invalid syntax, you can inspect the generated file to determine what went wrong, instead of having only gofmt's error to work with.
This commit is contained in:
Josh Bleecher Snyder
2021-01-03 19:29:11 -08:00
committed by GitHub
parent 039ef47f4f
commit 599bdd1269
2 changed files with 10 additions and 5 deletions

View File

@@ -30,6 +30,10 @@ func GoFmt(i Interface) Interface {
if err != nil {
return nil, err
}
return format.Source(b)
formatted, err := format.Source(b)
if err != nil {
return b, err
}
return formatted, nil
})
}