fix: sort enum decls (#1075)

This commit is contained in:
Garrett Delfosse 2022-04-19 11:02:32 -05:00 committed by GitHub
parent 97e07a49e9
commit 89aa39b5c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"log"
"os"
"path/filepath"
"sort"
"strings"
"golang.org/x/xerrors"
@ -69,9 +70,16 @@ func run() error {
handleValueSpec(s, enums)
})
// sort keys so output is always the same
var keys []string
for k := range enums {
keys = append(keys, k)
}
sort.Strings(keys)
// write each type alias declaration with possible values
for _, v := range enums {
_, _ = fmt.Printf("%s\n", v)
for _, k := range keys {
_, _ = fmt.Printf("%s\n", enums[k])
}
return nil