Skip to content

Commit

Permalink
Fix golangci-lint errors for CI
Browse files Browse the repository at this point in the history
Fixes golangci-lint errors for CI and skips error gosec G402.
  • Loading branch information
sayan-biswas committed Mar 19, 2024
1 parent 31e7555 commit 56a5345
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 20 deletions.
3 changes: 1 addition & 2 deletions pkg/image/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/build/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/reconciler/buildlimitcleanup/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand All @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/buildrun/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/buildrunttlcleanup/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
6 changes: 2 additions & 4 deletions test/utils/v1alpha1/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
},
Expand Down
6 changes: 2 additions & 4 deletions test/utils/v1beta1/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
},
Expand Down
6 changes: 2 additions & 4 deletions test/utils/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
},
Expand Down

0 comments on commit 56a5345

Please sign in to comment.