Skip to content

Commit b6da72d

Browse files
author
Zack Chase
committed
Clean up number generation [go]
1 parent 5f24388 commit b6da72d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

internal/gen/types/number.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package types
33
import (
44
"fmt"
55

6+
gogen "github.com/buildkite/buildkite-sdk/internal/gen/go"
67
"github.com/buildkite/buildkite-sdk/internal/gen/typescript"
78
"github.com/buildkite/buildkite-sdk/internal/gen/utils"
89
)
@@ -26,13 +27,12 @@ func (Number) IsPrimitive() bool {
2627

2728
// Go
2829
func (n Number) Go() (string, error) {
29-
block := utils.NewCodeBlock()
30-
if n.Description != "" {
31-
block.AddLines(fmt.Sprintf("// %s", n.Description))
32-
}
33-
34-
block.AddLines(fmt.Sprintf("type %s = int", n.Name.ToTitleCase()))
35-
return block.String(), nil
30+
typ := gogen.NewType(
31+
n.Name.ToTitleCase(),
32+
n.Description,
33+
"int",
34+
)
35+
return typ.String(), nil
3636
}
3737

3838
func (Number) GoStructType() string {

0 commit comments

Comments
 (0)