1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 13:29:11 +01:00

bump to k8s 1.24-rc.0

This commit is contained in:
JaneLiuL
2022-04-21 08:45:59 +08:00
parent e5ed0540f2
commit ecbd10afe2
942 changed files with 31997 additions and 28908 deletions

View File

@@ -19,6 +19,7 @@ package pointer
import (
"fmt"
"reflect"
"time"
)
// AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when,
@@ -184,7 +185,7 @@ func StringEqual(a, b *string) bool {
return *a == *b
}
// Float32 returns a pointer to the a float32.
// Float32 returns a pointer to a float32.
func Float32(i float32) *float32 {
return &i
}
@@ -214,7 +215,7 @@ func Float32Equal(a, b *float32) bool {
return *a == *b
}
// Float64 returns a pointer to the a float64.
// Float64 returns a pointer to a float64.
func Float64(i float64) *float64 {
return &i
}
@@ -243,3 +244,29 @@ func Float64Equal(a, b *float64) bool {
}
return *a == *b
}
// Duration returns a pointer to a time.Duration.
func Duration(d time.Duration) *time.Duration {
return &d
}
// DurationDeref dereferences the time.Duration ptr and returns it if not nil, or else
// returns def.
func DurationDeref(ptr *time.Duration, def time.Duration) time.Duration {
if ptr != nil {
return *ptr
}
return def
}
// DurationEqual returns true if both arguments are nil or both arguments
// dereference to the same value.
func DurationEqual(a, b *time.Duration) bool {
if (a == nil) != (b == nil) {
return false
}
if a == nil {
return true
}
return *a == *b
}