Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit176b481

Browse files
committed
Use correct array size for allocation
1 parent3865f36 commit176b481

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
funcmain() {
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
fork:=ranget.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
vars strings.Builder
213213
_,_=s.WriteString(g.posLine(v))
214214
_,_=s.WriteString(fmt.Sprintf("export type %s = %s\n",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp