Skip to content

Commit 89aa39b

Browse files
authored
fix: sort enum decls (coder#1075)
1 parent 97e07a4 commit 89aa39b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/apitypings/main.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"log"
99
"os"
1010
"path/filepath"
11+
"sort"
1112
"strings"
1213

1314
"golang.org/x/xerrors"
@@ -69,9 +70,16 @@ func run() error {
6970
handleValueSpec(s, enums)
7071
})
7172

73+
// sort keys so output is always the same
74+
var keys []string
75+
for k := range enums {
76+
keys = append(keys, k)
77+
}
78+
sort.Strings(keys)
79+
7280
// write each type alias declaration with possible values
73-
for _, v := range enums {
74-
_, _ = fmt.Printf("%s\n", v)
81+
for _, k := range keys {
82+
_, _ = fmt.Printf("%s\n", enums[k])
7583
}
7684

7785
return nil

0 commit comments

Comments
 (0)