add support for enums

This commit is contained in:
Ben Kraft
2020-04-10 18:16:32 -07:00
parent 9510470937
commit 7ab06dfd30
7 changed files with 203 additions and 35 deletions
+5
View File
@@ -6,6 +6,7 @@ import (
"go/format"
"path/filepath"
"runtime"
"sort"
"strings"
"text/template"
@@ -66,6 +67,10 @@ func (g *generator) Types() string {
for _, def := range g.typeMap {
defs = append(defs, def)
}
// Make sure we have a stable order. (It's somewhat
// arbitrary but in practice mostly alphabetical.)
// TODO: ideally we'd do a nice semantic ordering.
sort.Strings(defs)
return strings.Join(defs, "\n\n")
}