Skip to content

Commit

Permalink
internal: do not use max as it conflicts with a built-in function
Browse files Browse the repository at this point in the history
Revive complains about the use of `max` as variable name. go1.21
contains the `max()` function, so it is better to rename the variable.

Signed-off-by: Niels de Vos <[email protected]>
  • Loading branch information
nixpanic committed Jan 7, 2025
1 parent 95c5574 commit 7d53f9c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/retry/sizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ type SizeFunc func(size int) (hint Hint)
// DoubleSize or indicating a size not greater than the current size, the size
// is doubled. If the hint or next size is greater than the max size, the max
// size is used for a last retry.
func WithSizes(size int, max int, f SizeFunc) {
if size > max {
func WithSizes(size int, maxSize int, f SizeFunc) {
if size > maxSize {
return
}
for {
hint := f(size)
if hint == nil || size == max {
if hint == nil || size == maxSize {
break
}
if hint.size() > size {
size = hint.size()
} else {
size *= 2
}
if size > max {
size = max
if size > maxSize {
size = maxSize
}
}
}

0 comments on commit 7d53f9c

Please sign in to comment.