Skip to content

Commit 5326ec1

Browse files
committed
Fix uint parsing
1 parent 946cd17 commit 5326ec1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

option.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ var converters = map[reflect.Kind]converter{
9393
if err != nil {
9494
return nil, err
9595
}
96-
return int(val), err
96+
return uint(val), err
9797
},
9898
Float: func(v string) (interface{}, error) {
9999
return strconv.ParseFloat(v, 64)

option_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestParse(t *testing.T) {
7575
{opt: IntOption("int1"), str: "42", v: 42},
7676
{opt: IntOption("int1"), str: "fourtytwo", err: `strconv.ParseInt: parsing "fourtytwo": invalid syntax`},
7777
{opt: IntOption("int2"), str: "-42", v: -42},
78-
{opt: UintOption("uint1"), str: "23", v: 23},
78+
{opt: UintOption("uint1"), str: "23", v: uint(23)},
7979
{opt: UintOption("uint2"), str: "-23", err: `strconv.ParseUint: parsing "-23": invalid syntax`},
8080
{opt: BoolOption("true"), str: "true", v: true},
8181
{opt: BoolOption("true"), str: "", v: true},

0 commit comments

Comments
 (0)