1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

pkg/apis/nfd: drop unnecessary else statements

This commit is contained in:
Markus Lehtonen 2021-12-01 10:54:41 +02:00
parent 3f225be081
commit 1765a37c6a
2 changed files with 7 additions and 9 deletions

View file

@ -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)
}
}
}

View file

@ -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 '<key>=<value>')", trimmed)
} else {
out[split[0]] = split[1]
}
out[split[0]] = split[1]
}
}
return out, nil