Support parsing integer literals (#529)

This commit is contained in:
Sam Xie
2025-04-23 15:24:47 -07:00
committed by GitHub
parent f0b321097e
commit 66d5762b66
2 changed files with 27 additions and 2 deletions
+2 -2
View File
@@ -387,7 +387,7 @@ func intDecoder(bits int) MapperFunc { //nolint: dupl
default:
return fmt.Errorf("expected an int but got %q (%T)", t, t.Value)
}
n, err := strconv.ParseInt(sv, 10, bits)
n, err := strconv.ParseInt(sv, 0, bits)
if err != nil {
return fmt.Errorf("expected a valid %d bit int but got %q", bits, sv)
}
@@ -416,7 +416,7 @@ func uintDecoder(bits int) MapperFunc { //nolint: dupl
default:
return fmt.Errorf("expected an int but got %q (%T)", t, t.Value)
}
n, err := strconv.ParseUint(sv, 10, bits)
n, err := strconv.ParseUint(sv, 0, bits)
if err != nil {
return fmt.Errorf("expected a valid %d bit uint but got %q", bits, sv)
}