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 24, 2023
1 parent cf03d44 commit 9ae008f
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 @@ -16,47 +16,53 @@ limitations under the License.

package integer

// 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 9ae008f

Please sign in to comment.