Provisioning: Add better nil check (#110847)

This commit is contained in:
Stephanie Hingtgen
2025-09-09 18:23:11 -05:00
committed by GitHub
parent 451cc00b6a
commit 8805e93b1d
16 changed files with 79 additions and 50 deletions
+16
View File
@@ -0,0 +1,16 @@
package util
import "reflect"
func IsInterfaceNil(i interface{}) bool {
iv := reflect.ValueOf(i)
if !iv.IsValid() {
return true
}
switch iv.Kind() {
case reflect.Ptr, reflect.Slice, reflect.Map, reflect.Func, reflect.Interface:
return iv.IsNil()
default:
return false
}
}