Merge pull request #128796 from carlory/fix-framework-IgnoreNotFound

Fix a bug in framework.IgnoreNotFound
This commit is contained in:
Kubernetes Prow Robot 2024-12-12 02:58:10 +00:00 committed by GitHub
commit 2b8b276de8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,7 +97,12 @@ func IgnoreNotFound(in any) any {
inType := reflect.TypeOf(in)
inValue := reflect.ValueOf(in)
return reflect.MakeFunc(inType, func(args []reflect.Value) []reflect.Value {
out := inValue.Call(args)
var out []reflect.Value
if inType.IsVariadic() {
out = inValue.CallSlice(args)
} else {
out = inValue.Call(args)
}
if len(out) > 0 {
lastValue := out[len(out)-1]
last := lastValue.Interface()