From 79e7f4163d1b0795f0a033883d7781d92fc08615 Mon Sep 17 00:00:00 2001 From: Jay Pipes Date: Wed, 8 Feb 2023 14:06:29 -0500 Subject: [PATCH] gofmt 1.20 updates (style-only changes) (#110) Signed-off-by: Jay Pipes By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --- apis/core/v1alpha1/identifiers.go | 5 +++-- apis/core/v1alpha1/secret.go | 2 +- pkg/compare/delta.go | 21 +++++++++++---------- pkg/compare/nil_test.go | 1 - pkg/compare/path.go | 17 +++++++++-------- pkg/condition/condition_test.go | 2 +- pkg/runtime/reconciler.go | 18 +++++++++--------- 7 files changed, 34 insertions(+), 32 deletions(-) diff --git a/apis/core/v1alpha1/identifiers.go b/apis/core/v1alpha1/identifiers.go index a3de650..355d74e 100644 --- a/apis/core/v1alpha1/identifiers.go +++ b/apis/core/v1alpha1/identifiers.go @@ -56,8 +56,9 @@ type ResourceFieldSelector struct { // type to provide more user friendly syntax for references using 'from' field // Ex: // APIIDRef: -// from: -// name: my-api +// +// from: +// name: my-api type AWSResourceReferenceWrapper struct { From *AWSResourceReference `json:"from,omitempty"` } diff --git a/apis/core/v1alpha1/secret.go b/apis/core/v1alpha1/secret.go index a8ad5b0..52b0041 100644 --- a/apis/core/v1alpha1/secret.go +++ b/apis/core/v1alpha1/secret.go @@ -24,4 +24,4 @@ type SecretKeyReference struct { k8scorev1.SecretReference `json:""` // Key is the key within the secret Key string `json:"key"` -} \ No newline at end of file +} diff --git a/pkg/compare/delta.go b/pkg/compare/delta.go index 606c8d3..611bb96 100644 --- a/pkg/compare/delta.go +++ b/pkg/compare/delta.go @@ -43,16 +43,17 @@ func (d *Delta) DifferentAt(subject string) bool { // // For example, consider this code: // -// if delta.DifferentAt("Spec.Tags") { -// if err = rm.SyncTags(ctx, desired, latest); err != nil { -// return nil, err -// } -// } -// if !delta.DifferentExcept("Spec.Tags") { -// // We don't want to proceed to call the ModifyDBInstance API since -// // no other resource fields have changed. -// return desired, nil -// } +// if delta.DifferentAt("Spec.Tags") { +// if err = rm.SyncTags(ctx, desired, latest); err != nil { +// return nil, err +// } +// } +// +// if !delta.DifferentExcept("Spec.Tags") { +// // We don't want to proceed to call the ModifyDBInstance API since +// // no other resource fields have changed. +// return desired, nil +// } // // might be placed in an sdk_update_pre_build_request custom code hook to // prevent the ModifyDBInstance call from being executed if the DBInstance's diff --git a/pkg/compare/nil_test.go b/pkg/compare/nil_test.go index 04b3617..fbbf091 100644 --- a/pkg/compare/nil_test.go +++ b/pkg/compare/nil_test.go @@ -43,4 +43,3 @@ func TestNilDifference(t *testing.T) { require.True(compare.HasNilDifference(nullChan, nonNullChan)) } - diff --git a/pkg/compare/path.go b/pkg/compare/path.go index f12b2b2..1fba016 100644 --- a/pkg/compare/path.go +++ b/pkg/compare/path.go @@ -51,14 +51,15 @@ func (p Path) Pop() { } } -// Contains returns true if the supplied string, delimited on ".", matches -// p.parts up to the length of the supplied string. -// e.g. if the Path p represents "A.B": -// subject "A" -> true -// subject "A.B" -> true -// subject "A.B.C" -> false -// subject "B" -> false -// subject "A.C" -> false +// Contains returns true if the supplied string, delimited on ".", matches +// p.parts up to the length of the supplied string. +// +// e.g. if the Path p represents "A.B": +// subject "A" -> true +// subject "A.B" -> true +// subject "A.B.C" -> false +// subject "B" -> false +// subject "A.C" -> false func (p Path) Contains(subject string) bool { subjectSplit := strings.Split(subject, ".") diff --git a/pkg/condition/condition_test.go b/pkg/condition/condition_test.go index 9a39be4..6070d49 100644 --- a/pkg/condition/condition_test.go +++ b/pkg/condition/condition_test.go @@ -98,7 +98,7 @@ func TestConditionGetters(t *testing.T) { assert.Equal(len(gotAll), 2) conds = append(conds, &ackv1alpha1.Condition{ - Type: ackv1alpha1.ConditionTypeReferencesResolved, + Type: ackv1alpha1.ConditionTypeReferencesResolved, Status: corev1.ConditionTrue, }) r = &ackmocks.AWSResource{} diff --git a/pkg/runtime/reconciler.go b/pkg/runtime/reconciler.go index 262fc1b..54829e3 100644 --- a/pkg/runtime/reconciler.go +++ b/pkg/runtime/reconciler.go @@ -1085,15 +1085,15 @@ func (r *resourceReconciler) getEndpointURL( // getResyncPeriod returns the period of the recurring reconciler process which ensures the desired // state of custom resources is maintained. // It attempts to retrieve the duration from the following sources, in this order: -// 1. A resource-specific reconciliation resync period specified in the reconciliation resync -// configuration map (--reconcile-default-resync-seconds). -// 2. A resource-specific requeue on success period specified by the resource manager factory. -// The resource manager factory is controller-specific, and thus this period is to specified -// by controller authors (using ack-generate). -// 3. The default reconciliation resync period period specified in the controller binary flags. -// (--reconcile-resource-resync-seconds) -// 4. The default resync period defined in the ACK runtime package. Defined in defaultResyncPeriod -// within the same file +// 1. A resource-specific reconciliation resync period specified in the reconciliation resync +// configuration map (--reconcile-default-resync-seconds). +// 2. A resource-specific requeue on success period specified by the resource manager factory. +// The resource manager factory is controller-specific, and thus this period is to specified +// by controller authors (using ack-generate). +// 3. The default reconciliation resync period period specified in the controller binary flags. +// (--reconcile-resource-resync-seconds) +// 4. The default resync period defined in the ACK runtime package. Defined in defaultResyncPeriod +// within the same file // // Each reconciler has a unique value to use. This function should only be called during the // instantiation of an AWSResourceReconciler and should not be called during the reconciliation