mirror of https://github.com/docker/cli.git
opts: NormalizeCapability(): fix redefinition of the built-in function (revive)
opts/capabilities.go:25:2: redefines-builtin-id: redefinition of the built-in function cap (revive)
cap = strings.ToUpper(strings.TrimSpace(cap))
^
opts/capabilities.go:30:3: redefines-builtin-id: redefinition of the built-in function cap (revive)
cap = "CAP_" + cap
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f5fad186c0
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
ae7cd7e16a
commit
0cfc19830b
|
@ -21,15 +21,15 @@ const (
|
||||||
// This function only handles rudimentary formatting; no validation is performed,
|
// This function only handles rudimentary formatting; no validation is performed,
|
||||||
// as the list of available capabilities can be updated over time, thus should be
|
// as the list of available capabilities can be updated over time, thus should be
|
||||||
// handled by the daemon.
|
// handled by the daemon.
|
||||||
func NormalizeCapability(cap string) string {
|
func NormalizeCapability(capability string) string {
|
||||||
cap = strings.ToUpper(strings.TrimSpace(cap))
|
capability = strings.ToUpper(strings.TrimSpace(capability))
|
||||||
if cap == AllCapabilities || cap == ResetCapabilities {
|
if capability == AllCapabilities || capability == ResetCapabilities {
|
||||||
return cap
|
return capability
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(cap, "CAP_") {
|
if !strings.HasPrefix(capability, "CAP_") {
|
||||||
cap = "CAP_" + cap
|
capability = "CAP_" + capability
|
||||||
}
|
}
|
||||||
return cap
|
return capability
|
||||||
}
|
}
|
||||||
|
|
||||||
// CapabilitiesMap normalizes the given capabilities and converts them to a map.
|
// CapabilitiesMap normalizes the given capabilities and converts them to a map.
|
||||||
|
|
Loading…
Reference in New Issue