From 740b951cb5b6cac566df43f90d438e976e289eea Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Fri, 13 Nov 2020 00:25:57 +0900 Subject: [PATCH] cmd/generator: format output source --- cmd/generator/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/generator/main.go b/cmd/generator/main.go index 1b4482e..7ff4596 100644 --- a/cmd/generator/main.go +++ b/cmd/generator/main.go @@ -3,6 +3,7 @@ package main import ( "bytes" "fmt" + "go/format" "io/ioutil" "path/filepath" "runtime" @@ -380,7 +381,11 @@ func (t opType) fieldToStringTagField() opType { return err } path := filepath.Join(repoRoot(), "encode_optype.go") - return ioutil.WriteFile(path, b.Bytes(), 0644) + buf, err := format.Source(b.Bytes()) + if err != nil { + return err + } + return ioutil.WriteFile(path, buf, 0644) } func repoRoot() string {