aboutsummaryrefslogtreecommitdiff
path: root/internal/intconv
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-04 08:26:56 +0800
committerGravatar Runxi Yu2026-03-04 08:59:53 +0800
commitab7501be34032fb9e5c48726a68ae90a917af9eb (patch)
tree20d005647569befea8133e953c3270e8fd2a2a5b /internal/intconv
parent*: gofumpt (diff)
signatureNo signature
*: Lint
Diffstat (limited to 'internal/intconv')
-rw-r--r--internal/intconv/intconv.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/intconv/intconv.go b/internal/intconv/intconv.go
index 8bc77d8e..67f99a14 100644
--- a/internal/intconv/intconv.go
+++ b/internal/intconv/intconv.go
@@ -11,6 +11,7 @@ func Uint64ToInt(v uint64) (int, error) {
if v > uint64(math.MaxInt) {
return 0, fmt.Errorf("intconv: uint64 %d overflows int", v)
}
+
return int(v), nil
}
@@ -19,6 +20,7 @@ func UintptrToInt(v uintptr) (int, error) {
if v > uintptr(math.MaxInt) {
return 0, fmt.Errorf("intconv: uintptr %d overflows int", v)
}
+
return int(v), nil
}
@@ -27,6 +29,7 @@ func IntToUint64(v int) (uint64, error) {
if v < 0 {
return 0, fmt.Errorf("intconv: int %d is negative", v)
}
+
return uint64(v), nil
}
@@ -35,5 +38,6 @@ func Int64ToInt32(v int64) (int32, error) {
if v < math.MinInt32 || v > math.MaxInt32 {
return 0, fmt.Errorf("intconv: int64 %d overflows int32", v)
}
+
return int32(v), nil
}