From c08a9321eed6a917a2fbc13b8e023d2f4122ee36 Mon Sep 17 00:00:00 2001 From: Alexander Zielenski Date: Wed, 11 Oct 2023 13:51:49 -0700 Subject: [PATCH] cleanup: add header and fix spelling --- .../pkg/apiserver/validation/ratcheting.go | 4 +- .../apiserver/pkg/cel/common/equality.go | 38 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/ratcheting.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/ratcheting.go index f91cf2cbed2..0609d8eb66e 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/ratcheting.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/ratcheting.go @@ -190,11 +190,11 @@ func (r *ratchetingValueValidator) SubIndexValidator(index int, schema *spec.Sch var _ validate.ValueValidator = (&ratchetingValueValidator{}) -func (f ratchetingValueValidator) SetPath(path string) { +func (r ratchetingValueValidator) SetPath(path string) { // Do nothing // Unused by kube-openapi } -func (f ratchetingValueValidator) Applies(source interface{}, valueKind reflect.Kind) bool { +func (r ratchetingValueValidator) Applies(source interface{}, valueKind reflect.Kind) bool { return true } 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 c3c86ea29ba..10b03d01e1a 100644 --- a/staging/src/k8s.io/apiserver/pkg/cel/common/equality.go +++ b/staging/src/k8s.io/apiserver/pkg/cel/common/equality.go @@ -200,16 +200,16 @@ func (r *CorrelatedObject) CachedDeepEqual() (res bool) { // Returns nil if the given name is does not exist in the new object, or its // value is not correlatable to an old value. // If receiver is nil or if the new value is not an object/map, returns nil. -func (l *CorrelatedObject) Key(field string) *CorrelatedObject { - if l == nil || l.Schema == nil { +func (r *CorrelatedObject) Key(field string) *CorrelatedObject { + if r == nil || r.Schema == nil { return nil - } else if existing, exists := l.children[field]; exists { + } else if existing, exists := r.children[field]; exists { return existing } // Find correlated old value - oldAsMap, okOld := l.OldValue.(map[string]interface{}) - newAsMap, okNew := l.Value.(map[string]interface{}) + oldAsMap, okOld := r.OldValue.(map[string]interface{}) + newAsMap, okNew := r.Value.(map[string]interface{}) if !okOld || !okNew { return nil } @@ -221,20 +221,20 @@ func (l *CorrelatedObject) Key(field string) *CorrelatedObject { } var propertySchema Schema - if prop, exists := l.Schema.Properties()[field]; exists { + if prop, exists := r.Schema.Properties()[field]; exists { propertySchema = prop - } else if addP := l.Schema.AdditionalProperties(); addP != nil && addP.Schema() != nil { + } else if addP := r.Schema.AdditionalProperties(); addP != nil && addP.Schema() != nil { propertySchema = addP.Schema() } else { return nil } - if l.children == nil { - l.children = make(map[interface{}]*CorrelatedObject, len(newAsMap)) + if r.children == nil { + r.children = make(map[interface{}]*CorrelatedObject, len(newAsMap)) } res := NewCorrelatedObject(newValueForField, oldValueForField, propertySchema) - l.children[field] = res + r.children[field] = res return res } @@ -242,34 +242,34 @@ func (l *CorrelatedObject) Key(field string) *CorrelatedObject { // Returns nil if the given index is out of bounds, or its value is not // correlatable to an old value. // If receiver is nil or if the new value is not an array, returns nil. -func (l *CorrelatedObject) Index(i int) *CorrelatedObject { - if l == nil || l.Schema == nil { +func (r *CorrelatedObject) Index(i int) *CorrelatedObject { + if r == nil || r.Schema == nil { return nil - } else if existing, exists := l.children[i]; exists { + } else if existing, exists := r.children[i]; exists { return existing } - asList, ok := l.Value.([]interface{}) + asList, ok := r.Value.([]interface{}) if !ok || len(asList) <= i { return nil } - oldValueForIndex := l.correlateOldValueForChildAtNewIndex(i) + oldValueForIndex := r.correlateOldValueForChildAtNewIndex(i) if oldValueForIndex == nil { return nil } var itemSchema Schema - if i := l.Schema.Items(); i != nil { + if i := r.Schema.Items(); i != nil { itemSchema = i } else { return nil } - if l.children == nil { - l.children = make(map[interface{}]*CorrelatedObject, len(asList)) + if r.children == nil { + r.children = make(map[interface{}]*CorrelatedObject, len(asList)) } res := NewCorrelatedObject(asList[i], oldValueForIndex, itemSchema) - l.children[i] = res + r.children[i] = res return res }