Skip to content

Commit

Permalink
refactor: Use slices package
Browse files Browse the repository at this point in the history
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
  • Loading branch information
viccuad committed Sep 6, 2023
1 parent ac7de77 commit 60c8f95
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"
"slices"

logconfig "github.com/kubewarden/audit-scanner/internal/log"
"github.com/kubewarden/audit-scanner/internal/policies"
Expand Down Expand Up @@ -30,7 +31,7 @@ var level logconfig.Level
var logFormat string

// list of supported format of logs to stdout & stderr
var logFormatSupportedFormats = [1]string{"json"}
var logFormatSupportedFormats = []string{"json"}

// list of namespaces to be skipped from scan
var skippedNs []string
Expand Down Expand Up @@ -72,10 +73,7 @@ There will be a ClusterPolicyReport with results for cluster-wide resources.`,
if err != nil {
return err
}
switch logFormat {
// TODO use slices package in go 1.21
case "json": // skip
default:
if slices.Contains(logFormatSupportedFormats, logFormat) {
return fmt.Errorf("passed log-fmt not supported. Please select one of the supported formats: %v", logFormatSupportedFormats)
}

Expand Down

0 comments on commit 60c8f95

Please sign in to comment.