From 6876f3af1aaf38b45622461780b30980f33d308e Mon Sep 17 00:00:00 2001 From: mprahl Date: Fri, 20 Jan 2023 15:24:50 -0500 Subject: [PATCH] Fix the gosec:G601 error Signed-off-by: mprahl --- controllers/configurationpolicy_controller.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/configurationpolicy_controller.go b/controllers/configurationpolicy_controller.go index 80fe6686..73dc9a33 100644 --- a/controllers/configurationpolicy_controller.go +++ b/controllers/configurationpolicy_controller.go @@ -192,7 +192,9 @@ func (r *ConfigurationPolicyReconciler) PeriodicallyExecConfigPolicies(freq uint needDeploymentFinalizer := false - for _, plc := range policiesList.Items { + for i := range policiesList.Items { + plc := policiesList.Items[i] + if objHasFinalizer(&plc, pruneObjectFinalizer) { needDeploymentFinalizer = true