From 6fd65788ab43eb4a15a419b92e5622019af2652e Mon Sep 17 00:00:00 2001 From: Reto Lehmann Date: Mon, 18 Sep 2023 07:57:47 +0200 Subject: [PATCH] Fix golang-lint errors --- pkg/reconciler/ingress/ingress_test.go | 24 +++++++++---------- .../ingress/resources/reference_grant.go | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pkg/reconciler/ingress/ingress_test.go b/pkg/reconciler/ingress/ingress_test.go index 7702194c8..84c7e59d2 100644 --- a/pkg/reconciler/ingress/ingress_test.go +++ b/pkg/reconciler/ingress/ingress_test.go @@ -275,12 +275,12 @@ func TestReconcileTLS(t *testing.T) { Name: "Happy TLS", Key: "ns/name", Objects: []runtime.Object{ - ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName)), + ing(withBasicSpec, withGatewayAPIClass, withTLS()), secret(secretName, nsName), gw(defaultListener), }, WantCreates: []runtime.Object{ - httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName))), + httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS())), rp(secret(secretName, nsName)), }, WantUpdates: []clientgotesting.UpdateActionImpl{{ @@ -294,7 +294,7 @@ func TestReconcileTLS(t *testing.T) { Patch: []byte(`{"metadata":{"finalizers":["ingresses.networking.internal.knative.dev"],"resourceVersion":""}}`), }}, WantStatusUpdates: []clientgotesting.UpdateActionImpl{{ - Object: ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName), func(i *v1alpha1.Ingress) { + Object: ing(withBasicSpec, withGatewayAPIClass, withTLS(), func(i *v1alpha1.Ingress) { i.Status.InitializeConditions() i.Status.MarkLoadBalancerReady( []v1alpha1.LoadBalancerIngressStatus{{ @@ -313,17 +313,17 @@ func TestReconcileTLS(t *testing.T) { Name: "Already Configured", Key: "ns/name", Objects: []runtime.Object{ - ing(withBasicSpec, withFinalizer, withGatewayAPIClass, withTLS(secretName)), + ing(withBasicSpec, withFinalizer, withGatewayAPIClass, withTLS()), secret(secretName, nsName), gw(defaultListener, tlsListener("secure.example.com", nsName, secretName)), - httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName))), + httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS())), rp(secret(secretName, nsName)), }, WantUpdates: []clientgotesting.UpdateActionImpl{ // None }, WantStatusUpdates: []clientgotesting.UpdateActionImpl{{ - Object: ing(withBasicSpec, withFinalizer, withGatewayAPIClass, withTLS(secretName), func(i *v1alpha1.Ingress) { + Object: ing(withBasicSpec, withFinalizer, withGatewayAPIClass, withTLS(), func(i *v1alpha1.Ingress) { i.Status.InitializeConditions() i.Status.MarkLoadBalancerReady( []v1alpha1.LoadBalancerIngressStatus{{ @@ -342,14 +342,14 @@ func TestReconcileTLS(t *testing.T) { Key: "ns/name", SkipNamespaceValidation: true, Objects: []runtime.Object{ - ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName), func(i *v1alpha1.Ingress) { + ing(withBasicSpec, withGatewayAPIClass, withTLS(), func(i *v1alpha1.Ingress) { i.DeletionTimestamp = &metav1.Time{ Time: deleteTime, } }), secret(secretName, nsName), gw(defaultListener, tlsListener("secure.example.com", nsName, secretName)), - httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName))), + httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS())), rp(secret(secretName, nsName)), }, WantUpdates: []clientgotesting.UpdateActionImpl{{ @@ -360,11 +360,11 @@ func TestReconcileTLS(t *testing.T) { Key: "ns/name", WantErr: true, Objects: []runtime.Object{ - ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName)), + ing(withBasicSpec, withGatewayAPIClass, withTLS()), secret(secretName, nsName), }, WantCreates: []runtime.Object{ - httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName))), + httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS())), rp(secret(secretName, nsName)), }, WantUpdates: []clientgotesting.UpdateActionImpl{ @@ -378,7 +378,7 @@ func TestReconcileTLS(t *testing.T) { Patch: []byte(`{"metadata":{"finalizers":["ingresses.networking.internal.knative.dev"],"resourceVersion":""}}`), }}, WantStatusUpdates: []clientgotesting.UpdateActionImpl{{ - Object: ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName), func(i *v1alpha1.Ingress) { + Object: ing(withBasicSpec, withGatewayAPIClass, withTLS(), func(i *v1alpha1.Ingress) { i.Status.InitializeConditions() i.Status.MarkIngressNotReady("ReconcileIngressFailed", "Ingress reconciliation failed") }), @@ -599,7 +599,7 @@ var withFinalizer = func(i *v1alpha1.Ingress) { i.Finalizers = append(i.Finalizers, "ingresses.networking.internal.knative.dev") } -func withTLS(secret string) IngressOption { +func withTLS() IngressOption { return func(i *v1alpha1.Ingress) { i.Spec.TLS = append(i.Spec.TLS, v1alpha1.IngressTLS{ Hosts: []string{"secure.example.com"}, diff --git a/pkg/reconciler/ingress/resources/reference_grant.go b/pkg/reconciler/ingress/resources/reference_grant.go index 90dfa90e2..1aefbf427 100644 --- a/pkg/reconciler/ingress/resources/reference_grant.go +++ b/pkg/reconciler/ingress/resources/reference_grant.go @@ -26,7 +26,7 @@ import ( ) // Grant the resource "to" access to the resource "from" -func MakeReferenceGrant(ctx context.Context, ing *netv1alpha1.Ingress, to, from metav1.PartialObjectMetadata) *gatewayv1alpha2.ReferenceGrant { +func MakeReferenceGrant(_ context.Context, ing *netv1alpha1.Ingress, to, from metav1.PartialObjectMetadata) *gatewayv1alpha2.ReferenceGrant { name := to.Name if len(name)+len(from.Namespace) > 62 { name = name[:62-len(from.Namespace)]