From e534860a0aebd0d958818bd4de236f7fe7b053b0 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 9 Jan 2021 19:44:21 +0300 Subject: [PATCH] always format files Signed-off-by: Vasiliy Tolstov --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index ccfe38f..def58a4 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "go/format" "io" "io/ioutil" "log" @@ -222,6 +224,14 @@ func main() { // Generate the protobufs 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) if err != nil { g.Error(err, "failed to marshal output proto")