Skip to content

Commit 4df8a66

Browse files
yingshanghuangqiaosagikazarmark
authored andcommitted
refactor: use the built-in max/min to simplify the code
Signed-off-by: yingshanghuangqiao <[email protected]>
1 parent b7b9904 commit 4df8a66

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

util.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,7 @@ func parseSizeInBytes(sizeStr string) uint {
174174
}
175175
}
176176

177-
size := cast.ToInt(sizeStr)
178-
if size < 0 {
179-
size = 0
180-
}
177+
size := max(cast.ToInt(sizeStr), 0)
181178

182179
return safeMul(uint(size), multiplier)
183180
}

0 commit comments

Comments
 (0)