diff --git a/.golangci.yaml b/.golangci.yaml index bfcb3006d8..b44c327aea 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -9,6 +9,7 @@ linters: - nolintlint - staticcheck - unused + - gocognit linters-settings: nolintlint: require-explanation: true diff --git a/controllers/helpers.go b/controllers/helpers.go index 49fabedf68..4efe8a521e 100644 --- a/controllers/helpers.go +++ b/controllers/helpers.go @@ -469,9 +469,10 @@ func deleteCategoryKeyValues(ctx context.Context, client *prismclientv3.Client, ciValue := ci.Value if gck, ok := groupCategoriesByKey[ciKey]; ok { groupCategoriesByKey[ciKey] = append(gck, ciValue) - } else { - groupCategoriesByKey[ciKey] = []string{ciValue} + continue } + + groupCategoriesByKey[ciKey] = []string{ciValue} } for key, values := range groupCategoriesByKey {