aboutsummaryrefslogtreecommitdiffstats
path: root/sysgen
diff options
context:
space:
mode:
Diffstat (limited to 'sysgen')
-rw-r--r--sysgen/sysgen.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/sysgen/sysgen.go b/sysgen/sysgen.go
index b30a04437..32616cae5 100644
--- a/sysgen/sysgen.go
+++ b/sysgen/sysgen.go
@@ -8,6 +8,7 @@ import (
"bytes"
"flag"
"fmt"
+ "go/format"
"io"
"io/ioutil"
"os"
@@ -810,7 +811,12 @@ func isIdentifier(s string) bool {
return true
}
-func writeSource(file string, src []byte) {
+func writeSource(file string, data []byte) {
+ src, err := format.Source(data)
+ if err != nil {
+ fmt.Printf("%s\n", data)
+ failf("failed to format output: %v", err)
+ }
if oldSrc, err := ioutil.ReadFile(file); err == nil && bytes.Equal(src, oldSrc) {
return
}