Skip to content

Commit

Permalink
Merge pull request #1201 from mtrmac/unused
Browse files Browse the repository at this point in the history
Fix an unused line in applyNameOperation
  • Loading branch information
vrothberg committed Apr 14, 2022
2 parents b3a57ab + fdd89d3 commit 9f4f5fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils.go
Expand Up @@ -42,13 +42,14 @@ func validateMountOptions(mountOptions []string) error {
}

func applyNameOperation(oldNames []string, opParameters []string, op updateNameOperation) ([]string, error) {
result := make([]string, 0)
var result []string
switch op {
case setNames:
// ignore all old names and just return new names
return dedupeNames(opParameters), nil
result = opParameters
case removeNames:
// remove given names from old names
result = make([]string, 0, len(oldNames))
for _, name := range oldNames {
// only keep names in final result which do not intersect with input names
// basically `result = oldNames - opParameters`
Expand All @@ -62,11 +63,10 @@ func applyNameOperation(oldNames []string, opParameters []string, op updateNameO
result = append(result, name)
}
}
return dedupeNames(result), nil
case addNames:
result = make([]string, 0, len(opParameters)+len(oldNames))
result = append(result, opParameters...)
result = append(result, oldNames...)
return dedupeNames(result), nil
default:
return result, errInvalidUpdateNameOperation
}
Expand Down

0 comments on commit 9f4f5fb

Please sign in to comment.