From 56a53450546dc1b128259a81c09784c5c981a54a Mon Sep 17 00:00:00 2001 From: Sayan Biswas Date: Tue, 19 Mar 2024 14:41:53 +0530 Subject: [PATCH] Fix golangci-lint errors for CI Fixes golangci-lint errors for CI and skips error gosec G402. --- pkg/image/options.go | 3 +-- pkg/reconciler/build/controller.go | 2 +- pkg/reconciler/buildlimitcleanup/controller.go | 6 +++--- pkg/reconciler/buildrun/controller.go | 2 +- pkg/reconciler/buildrunttlcleanup/controller.go | 2 +- test/utils/v1alpha1/webhook.go | 6 ++---- test/utils/v1beta1/webhook.go | 6 ++---- test/utils/webhook.go | 6 ++---- 8 files changed, 13 insertions(+), 20 deletions(-) diff --git a/pkg/image/options.go b/pkg/image/options.go index 891cb9ac89..95ffbdd786 100644 --- a/pkg/image/options.go +++ b/pkg/image/options.go @@ -54,9 +54,8 @@ func GetOptions(ctx context.Context, imageName name.Reference, insecure bool, do transport := http.DefaultTransport.(*http.Transport).Clone() if insecure { - // #nosec:G402 explicitly requested by user to use insecure registry transport.TLSClientConfig = &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: true, // #nosec G402 explicitly requested by user to use insecure registry } } else { transport.TLSClientConfig = &tls.Config{ diff --git a/pkg/reconciler/build/controller.go b/pkg/reconciler/build/controller.go index a600894707..ec46c7500b 100644 --- a/pkg/reconciler/build/controller.go +++ b/pkg/reconciler/build/controller.go @@ -84,7 +84,7 @@ func add(ctx context.Context, mgr manager.Manager, r reconcile.Reconciler, maxCo // or BuildRunDeletion annotation does not change return o.GetGeneration() != n.GetGeneration() || buildRunDeletionAnnotation }, - DeleteFunc: func(e event.DeleteEvent) bool { + DeleteFunc: func(_ event.DeleteEvent) bool { // Never reconcile on deletion, there is nothing we have to do return false }, diff --git a/pkg/reconciler/buildlimitcleanup/controller.go b/pkg/reconciler/buildlimitcleanup/controller.go index adedbbe8bb..15bd8240e4 100644 --- a/pkg/reconciler/buildlimitcleanup/controller.go +++ b/pkg/reconciler/buildlimitcleanup/controller.go @@ -75,14 +75,14 @@ func add(mgr manager.Manager, r reconcile.Reconciler, maxConcurrentReconciles in } return false }, - DeleteFunc: func(e event.DeleteEvent) bool { + DeleteFunc: func(_ event.DeleteEvent) bool { // Never reconcile on deletion, there is nothing we have to do return false }, } predBuildRun := predicate.Funcs{ - CreateFunc: func(e event.CreateEvent) bool { + CreateFunc: func(_ event.CreateEvent) bool { // Never reconcile in case of create buildrun event return false }, @@ -106,7 +106,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler, maxConcurrentReconciles in } return false }, - DeleteFunc: func(e event.DeleteEvent) bool { + DeleteFunc: func(_ event.DeleteEvent) bool { // Never reconcile on deletion, there is nothing we have to do return false }, diff --git a/pkg/reconciler/buildrun/controller.go b/pkg/reconciler/buildrun/controller.go index b6341c38cd..dfb9dbf933 100644 --- a/pkg/reconciler/buildrun/controller.go +++ b/pkg/reconciler/buildrun/controller.go @@ -73,7 +73,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler, maxConcurrentReconciles in return false }, - DeleteFunc: func(e event.DeleteEvent) bool { + DeleteFunc: func(_ event.DeleteEvent) bool { // Never reconcile on deletion, there is nothing we have to do return false }, diff --git a/pkg/reconciler/buildrunttlcleanup/controller.go b/pkg/reconciler/buildrunttlcleanup/controller.go index 6d997aad1b..fe893363bc 100644 --- a/pkg/reconciler/buildrunttlcleanup/controller.go +++ b/pkg/reconciler/buildrunttlcleanup/controller.go @@ -131,7 +131,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler, maxConcurrentReconciles in return false }, - DeleteFunc: func(e event.DeleteEvent) bool { + DeleteFunc: func(_ event.DeleteEvent) bool { // Never reconcile on deletion, there is nothing we have to do return false }, diff --git a/test/utils/v1alpha1/webhook.go b/test/utils/v1alpha1/webhook.go index 731a7133ed..080312655b 100644 --- a/test/utils/v1alpha1/webhook.go +++ b/test/utils/v1alpha1/webhook.go @@ -55,9 +55,8 @@ func StartBuildWebhook() *http.Server { Transport: &http.Transport{ IdleConnTimeout: 5 * time.Second, ResponseHeaderTimeout: 5 * time.Second, - // #nosec:G402 test code TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: true, // #nosec G402 }, TLSHandshakeTimeout: 5 * time.Second, }, @@ -85,9 +84,8 @@ func StopBuildWebhook(webhookServer *http.Server) { Transport: &http.Transport{ IdleConnTimeout: 5 * time.Second, ResponseHeaderTimeout: 5 * time.Second, - // #nosec:G402 test code TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: true, // #nosec G402 }, TLSHandshakeTimeout: 5 * time.Second, }, diff --git a/test/utils/v1beta1/webhook.go b/test/utils/v1beta1/webhook.go index 731a7133ed..080312655b 100644 --- a/test/utils/v1beta1/webhook.go +++ b/test/utils/v1beta1/webhook.go @@ -55,9 +55,8 @@ func StartBuildWebhook() *http.Server { Transport: &http.Transport{ IdleConnTimeout: 5 * time.Second, ResponseHeaderTimeout: 5 * time.Second, - // #nosec:G402 test code TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: true, // #nosec G402 }, TLSHandshakeTimeout: 5 * time.Second, }, @@ -85,9 +84,8 @@ func StopBuildWebhook(webhookServer *http.Server) { Transport: &http.Transport{ IdleConnTimeout: 5 * time.Second, ResponseHeaderTimeout: 5 * time.Second, - // #nosec:G402 test code TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: true, // #nosec G402 }, TLSHandshakeTimeout: 5 * time.Second, }, diff --git a/test/utils/webhook.go b/test/utils/webhook.go index 731a7133ed..080312655b 100644 --- a/test/utils/webhook.go +++ b/test/utils/webhook.go @@ -55,9 +55,8 @@ func StartBuildWebhook() *http.Server { Transport: &http.Transport{ IdleConnTimeout: 5 * time.Second, ResponseHeaderTimeout: 5 * time.Second, - // #nosec:G402 test code TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: true, // #nosec G402 }, TLSHandshakeTimeout: 5 * time.Second, }, @@ -85,9 +84,8 @@ func StopBuildWebhook(webhookServer *http.Server) { Transport: &http.Transport{ IdleConnTimeout: 5 * time.Second, ResponseHeaderTimeout: 5 * time.Second, - // #nosec:G402 test code TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: true, // #nosec G402 }, TLSHandshakeTimeout: 5 * time.Second, },