From ebdb181a4771b81fce00e0ec6b246718831ab729 Mon Sep 17 00:00:00 2001 From: Tom Godkin Date: Fri, 30 Aug 2024 08:55:50 +0100 Subject: [PATCH] Remove redundant function Signed-off-by: Tom Godkin --- go.mod | 2 +- libcontainer/capabilities/capabilities.go | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index cd65bd3b7b7..54545cb4e1f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/opencontainers/runc -go 1.22 +go 1.23 require ( github.com/checkpoint-restore/go-criu/v6 v6.3.0 diff --git a/libcontainer/capabilities/capabilities.go b/libcontainer/capabilities/capabilities.go index 69884ef992a..54ffd78e4e9 100644 --- a/libcontainer/capabilities/capabilities.go +++ b/libcontainer/capabilities/capabilities.go @@ -3,7 +3,8 @@ package capabilities import ( - "sort" + "maps" + "slices" "strings" "github.com/opencontainers/runc/libcontainer/configs" @@ -69,7 +70,7 @@ func New(capConfig *configs.Capabilities) (*Caps, error) { return nil, err } if len(unknownCaps) > 0 { - logrus.Warn("ignoring unknown or unavailable capabilities: ", mapKeys(unknownCaps)) + logrus.Warn("ignoring unknown or unavailable capabilities: ", slices.Sorted(maps.Keys(unknownCaps))) } return &c, nil } @@ -89,16 +90,6 @@ func capSlice(caps []string, unknownCaps map[string]struct{}) []capability.Cap { return out } -// mapKeys returns the keys of input in sorted order -func mapKeys(input map[string]struct{}) []string { - var keys []string - for c := range input { - keys = append(keys, c) - } - sort.Strings(keys) - return keys -} - // Caps holds the capabilities for a container. type Caps struct { pid capability.Capabilities