Skip to content

Commit

Permalink
fix linting error - refactor if else chain to switch
Browse files Browse the repository at this point in the history
Signed-off-by: gokulav137 <[email protected]>
  • Loading branch information
gokulav137 committed Sep 12, 2023
1 parent e29d940 commit 3030191
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions eventsources/sources/resource/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,12 @@ func LabelReq(sel v1alpha1.Selector) (*labels.Requirement, error) {
op = selection.Operator(sel.Operation)
}
var values []string
if (op == selection.Exists || op == selection.DoesNotExist) && sel.Value == "" {
switch {
case (op == selection.Exists || op == selection.DoesNotExist) && sel.Value == "":
values = []string{}
} else if op == selection.In || op == selection.NotIn {
case op == selection.In || op == selection.NotIn:
values = strings.Split(sel.Value, ",")
} else {
default:
values = []string{sel.Value}
}
req, err := labels.NewRequirement(sel.Key, op, values)
Expand Down

0 comments on commit 3030191

Please sign in to comment.