diff --git a/pkg/apis/nfd/v1alpha1/expression.go b/pkg/apis/nfd/v1alpha1/expression.go index 0eaf49c0d..303b9b239 100644 --- a/pkg/apis/nfd/v1alpha1/expression.go +++ b/pkg/apis/nfd/v1alpha1/expression.go @@ -443,13 +443,12 @@ func (m *MatchExpressionSet) UnmarshalJSON(data []byte) error { expressions := make(map[string]*MatchExpression) if err := json.Unmarshal(data, &expressions); err != nil { return err - } else { - for k, v := range expressions { - if v != nil { - (*m).Expressions[k] = v - } else { - (*m).Expressions[k] = newMatchExpression(MatchExists) - } + } + for k, v := range expressions { + if v != nil { + (*m).Expressions[k] = v + } else { + (*m).Expressions[k] = newMatchExpression(MatchExists) } } } diff --git a/pkg/apis/nfd/v1alpha1/rule.go b/pkg/apis/nfd/v1alpha1/rule.go index 771a22e7c..3a4350fc2 100644 --- a/pkg/apis/nfd/v1alpha1/rule.go +++ b/pkg/apis/nfd/v1alpha1/rule.go @@ -257,9 +257,8 @@ func (h *templateHelper) expandMap(data interface{}) (map[string]string, error) split := strings.SplitN(trimmed, "=", 2) if len(split) == 1 { return nil, fmt.Errorf("missing value in expanded template line %q, (format must be '=')", trimmed) - } else { - out[split[0]] = split[1] } + out[split[0]] = split[1] } } return out, nil