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:
committed by
GitHub
parent
039ef47f4f
commit
599bdd1269
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user