Skip to content

Commit 0a6ed1e

Browse files
committed
address linter comments
1 parent 3f059dc commit 0a6ed1e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

internal/controller/controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,13 +482,14 @@ func getCacheKey(dn, digest string) string {
482482
// If namespace is non-empty, it will only watch that namespace.
483483
func createInformerFactory(clientset kubernetes.Interface, namespace string, excludeNamespaces string) informers.SharedInformerFactory {
484484
var factory informers.SharedInformerFactory
485-
if namespace != "" {
485+
switch {
486+
case namespace != "":
486487
factory = informers.NewSharedInformerFactoryWithOptions(
487488
clientset,
488489
30*time.Second,
489490
informers.WithNamespace(namespace),
490491
)
491-
} else if excludeNamespaces != "" {
492+
case excludeNamespaces != "":
492493
excludedNamespacesList := strings.Split(excludeNamespaces, ",")
493494
for i := 0; i < len(excludedNamespacesList); i++ {
494495
excludedNamespacesList[i] = fmt.Sprintf("metadata.namespace!=%s", strings.TrimSpace(excludedNamespacesList[i]))
@@ -502,7 +503,7 @@ func createInformerFactory(clientset kubernetes.Interface, namespace string, exc
502503
30*time.Second,
503504
informers.WithTweakListOptions(tweakListOptions),
504505
)
505-
} else {
506+
default:
506507
factory = informers.NewSharedInformerFactory(clientset,
507508
30*time.Second,
508509
)

0 commit comments

Comments
 (0)