From 0cfc19830b6dc5a3d81e3d020d3d0f7b9fda4111 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 29 Mar 2023 16:01:56 +0200 Subject: [PATCH] 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 (cherry picked from commit f5fad186c081dcbd77d45a5e9d4eb295e87028d9) Signed-off-by: Sebastiaan van Stijn --- opts/capabilities.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/opts/capabilities.go b/opts/capabilities.go index 8b57870376..82d071853b 100644 --- a/opts/capabilities.go +++ b/opts/capabilities.go @@ -21,15 +21,15 @@ const ( // This function only handles rudimentary formatting; no validation is performed, // as the list of available capabilities can be updated over time, thus should be // handled by the daemon. -func NormalizeCapability(cap string) string { - cap = strings.ToUpper(strings.TrimSpace(cap)) - if cap == AllCapabilities || cap == ResetCapabilities { - return cap +func NormalizeCapability(capability string) string { + capability = strings.ToUpper(strings.TrimSpace(capability)) + if capability == AllCapabilities || capability == ResetCapabilities { + return capability } - if !strings.HasPrefix(cap, "CAP_") { - cap = "CAP_" + cap + if !strings.HasPrefix(capability, "CAP_") { + capability = "CAP_" + capability } - return cap + return capability } // CapabilitiesMap normalizes the given capabilities and converts them to a map.