Skip to content

Commit 176b481

Browse files
committed
Use correct array size for allocation
1 parent 3865f36 commit 176b481

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/apitypings/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const (
2323
indent = " "
2424
)
2525

26-
// TODO: Handle httpapi.Response and other types
2726
func main() {
2827
ctx := context.Background()
2928
log := slog.Make(sloghuman.Sink(os.Stderr))
@@ -49,7 +48,7 @@ func (t TypescriptTypes) String() string {
4948
_, _ = s.WriteString("// Code generated by 'make coder/scripts/apitypings/main.go'. DO NOT EDIT.\n\n")
5049

5150
sortedTypes := make([]string, 0, len(t.Types))
52-
sortedEnums := make([]string, 0, len(t.Types))
51+
sortedEnums := make([]string, 0, len(t.Enums))
5352

5453
for k := range t.Types {
5554
sortedTypes = append(sortedTypes, k)
@@ -209,6 +208,7 @@ func (g *Generator) generateAll() (*TypescriptTypes, error) {
209208
// here.
210209
values = append(values, elem.Val().String())
211210
}
211+
sort.Strings(values)
212212
var s strings.Builder
213213
_, _ = s.WriteString(g.posLine(v))
214214
_, _ = s.WriteString(fmt.Sprintf("export type %s = %s\n",

0 commit comments

Comments
 (0)