Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: sort enum decls
  • Loading branch information
f0ssel committed Apr 19, 2022
commit 0cb109af35bf8345c03de612ece21a0216d0f80c
12 changes: 10 additions & 2 deletions scripts/apitypings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"log"
"os"
"path/filepath"
"sort"
"strings"

"golang.org/x/xerrors"
Expand Down Expand Up @@ -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
Expand Down