From 337374504e1e5ed971733c435fe2b095a2a76081 Mon Sep 17 00:00:00 2001 From: Chetan Banavikalmutt Date: Thu, 21 Mar 2024 17:17:28 +0530 Subject: [PATCH] fix: lint errors reported by golangci-lint Signed-off-by: Chetan Banavikalmutt --- cmd/rollouts-controller/main.go | 1 + controller/metrics/prommetrics.go | 2 +- rollout/canary_test.go | 3 --- rollout/service_test.go | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/rollouts-controller/main.go b/cmd/rollouts-controller/main.go index b144defca4..9581da23c0 100644 --- a/cmd/rollouts-controller/main.go +++ b/cmd/rollouts-controller/main.go @@ -131,6 +131,7 @@ func newCommand() *cobra.Command { discoveryClient, err := discovery.NewDiscoveryClientForConfig(config) checkError(err) smiClient, err := smiclientset.NewForConfig(config) + checkError(err) resyncDuration := time.Duration(rolloutResyncPeriod) * time.Second kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions( kubeClient, diff --git a/controller/metrics/prommetrics.go b/controller/metrics/prommetrics.go index 3e55ba1ccb..c0d3b89f62 100644 --- a/controller/metrics/prommetrics.go +++ b/controller/metrics/prommetrics.go @@ -135,7 +135,7 @@ var ( MetricAnalysisTemplateInfo = prometheus.NewDesc( "analysis_template_info", "Information about analysis templates.", - append(namespaceNameLabels), + namespaceNameLabels, nil, ) diff --git a/rollout/canary_test.go b/rollout/canary_test.go index d92cfd2c17..3591c66f24 100644 --- a/rollout/canary_test.go +++ b/rollout/canary_test.go @@ -870,7 +870,6 @@ func TestRollBackToActiveReplicaSetWithinWindow(t *testing.T) { f.kubeobjects = append(f.kubeobjects, rs1, rs2) f.replicaSetLister = append(f.replicaSetLister, rs1, rs2) - f.serviceLister = append(f.serviceLister) // Switch back to version 1 r2.Spec.Template = r1.Spec.Template @@ -1567,8 +1566,6 @@ func TestCanaryRolloutWithInvalidPingServiceName(t *testing.T) { f.rolloutLister = append(f.rolloutLister, r) f.objects = append(f.objects, r) - f.kubeobjects = append(f.kubeobjects) - f.serviceLister = append(f.serviceLister) patchIndex := f.expectPatchRolloutAction(r) f.run(getKey(r, t)) diff --git a/rollout/service_test.go b/rollout/service_test.go index cb15367a3a..0466634bde 100644 --- a/rollout/service_test.go +++ b/rollout/service_test.go @@ -158,7 +158,6 @@ func TestPreviewServiceNotFound(t *testing.T) { activeSvc := newService("active-svc", 80, nil, nil) notUsedPreviewSvc := newService("preview-svc", 80, nil, nil) f.kubeobjects = append(f.kubeobjects, activeSvc) - f.serviceLister = append(f.serviceLister) patchIndex := f.expectPatchRolloutAction(r) f.run(getKey(r, t))