always format files

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-01-09 19:44:21 +03:00
parent c27cf5982d
commit e534860a0a

10
main.go
View File

@ -1,6 +1,8 @@
package main package main
import ( import (
"fmt"
"go/format"
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
@ -222,6 +224,14 @@ func main() {
// Generate the protobufs // Generate the protobufs
g.GenerateAllFiles() g.GenerateAllFiles()
for _, f := range g.Response.File {
fdata, err := format.Source([]byte(*f.Content))
if err != nil {
g.Error(err, fmt.Sprintf("failed to format output: %s", *f.Content))
}
*f.Content = string(fdata)
}
data, err = proto.Marshal(g.Response) data, err = proto.Marshal(g.Response)
if err != nil { if err != nil {
g.Error(err, "failed to marshal output proto") g.Error(err, "failed to marshal output proto")