From abb68591afd30cf263b0d6bb2942f9693eb420d7 Mon Sep 17 00:00:00 2001 From: Alexander Zielenski Date: Fri, 13 Oct 2023 13:54:53 -0700 Subject: [PATCH] cleanup: clarify correlatedOldValueForChildAtNewIndex comment --- staging/src/k8s.io/apiserver/pkg/cel/common/equality.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/cel/common/equality.go b/staging/src/k8s.io/apiserver/pkg/cel/common/equality.go index 952134e6d19..c6bba114a9a 100644 --- a/staging/src/k8s.io/apiserver/pkg/cel/common/equality.go +++ b/staging/src/k8s.io/apiserver/pkg/cel/common/equality.go @@ -68,11 +68,14 @@ func NewCorrelatedObject(new, old interface{}, schema Schema) *CorrelatedObject } // If oldValue is not a list, returns nil -// If oldValue is a list takes mapType into account and attempts to find the -// old value with the same index or key, depending upon the mapType. +// If oldValue is a list, this function takes mapType into account and attempts +// to find the old value with the same index or key // // If listType is map, creates a map representation of the list using the designated -// map-keys and caches it for future calls. +// map-keys, caches it for future calls, and returns the map value, or nil if +// the correlated key is not in the old map +// +// If the list type is not correlatable this funcion returns nil. func (r *CorrelatedObject) correlateOldValueForChildAtNewIndex(index int) interface{} { oldAsList, ok := r.OldValue.([]interface{}) if !ok {