diff --git a/scalar.go b/scalar.go index 421bfac..0c17cd4 100644 --- a/scalar.go +++ b/scalar.go @@ -108,13 +108,13 @@ func ParseValue(v reflect.Value, s string) error { } v.SetBool(x) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - x, err := strconv.ParseInt(s, 10, v.Type().Bits()) + x, err := strconv.ParseInt(s, 0, v.Type().Bits()) if err != nil { return err } v.SetInt(x) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - x, err := strconv.ParseUint(s, 10, v.Type().Bits()) + x, err := strconv.ParseUint(s, 0, v.Type().Bits()) if err != nil { return err } diff --git a/scalar_test.go b/scalar_test.go index 1c51c77..e1fc03d 100644 --- a/scalar_test.go +++ b/scalar_test.go @@ -48,6 +48,7 @@ func TestParseValue(t *testing.T) { // integers assertParse(t, int(123), "123") + assertParse(t, int(123), "1_2_3") assertParse(t, int8(123), "123") assertParse(t, int16(123), "123") assertParse(t, int32(123), "123") @@ -55,6 +56,7 @@ func TestParseValue(t *testing.T) { // unsigned integers assertParse(t, uint(123), "123") + assertParse(t, uint(123), "1_2_3") assertParse(t, byte(123), "123") assertParse(t, uint8(123), "123") assertParse(t, uint16(123), "123")