Skip to content

Commit a0db4d0

Browse files
committed
[housekeeping] use dedicated strconv fns
1 parent 7222df8 commit a0db4d0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"log/slog"
66
"os"
77
"regexp"
8+
"strconv"
89

910
"github.com/pb33f/libopenapi"
1011
v3 "github.com/pb33f/libopenapi/datamodel/high/v3"
@@ -179,13 +180,13 @@ func interpolatePath(cmd *cobra.Command, h *HandlerData) error {
179180
value, _ = flags.GetString(param.Name)
180181
case Integer:
181182
v, _ := flags.GetInt(param.Name)
182-
value = fmt.Sprintf("%d", v)
183+
value = strconv.FormatInt(int64(v), 10)
183184
case Number:
184185
v, _ := flags.GetFloat64(param.Name)
185-
value = fmt.Sprintf("%g", v)
186+
value = strconv.FormatFloat(v, 'g', -1, 64)
186187
case Boolean:
187188
v, _ := flags.GetBool(param.Name)
188-
value = fmt.Sprintf("%t", v)
189+
value = strconv.FormatBool(v)
189190
}
190191

191192
h.Path = pattern.ReplaceAllString(h.Path, value)

0 commit comments

Comments
 (0)