Skip to content

Commit

Permalink
Deprecate integer min/max functions
Browse files Browse the repository at this point in the history
Go 1.21 provides min/max builtins. New code going into other
Kubernetes repositories (requiring Go 1.21 or later) should use those
instead.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
  • Loading branch information
skitt committed Nov 29, 2023
1 parent b307cd5 commit 3abbf95
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions integer/integer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,53 @@ package integer

import "math"

// IntMax returns the maximum of the params
// IntMax returns the maximum of the params.
// Deprecated: for new code, use the max() builtin instead.
func IntMax(a, b int) int {
if b > a {
return b
}
return a
}

// IntMin returns the minimum of the params
// IntMin returns the minimum of the params.
// Deprecated: for new code, use the min() builtin instead.
func IntMin(a, b int) int {
if b < a {
return b
}
return a
}

// Int32Max returns the maximum of the params
// Int32Max returns the maximum of the params.
// Deprecated: for new code, use the max() builtin instead.
func Int32Max(a, b int32) int32 {
if b > a {
return b
}
return a
}

// Int32Min returns the minimum of the params
// Int32Min returns the minimum of the params.
// Deprecated: for new code, use the min() builtin instead.
func Int32Min(a, b int32) int32 {
if b < a {
return b
}
return a
}

// Int64Max returns the maximum of the params
// Int64Max returns the maximum of the params.
// Deprecated: for new code, use the max() builtin instead.
func Int64Max(a, b int64) int64 {
if b > a {
return b
}
return a
}

// Int64Min returns the minimum of the params
// Int64Min returns the minimum of the params.
// Deprecated: for new code, use the min() builtin instead.
func Int64Min(a, b int64) int64 {
if b < a {
return b
Expand Down

0 comments on commit 3abbf95

Please sign in to comment.