diff --git a/libcontainer/configs/namespaces_linux.go b/libcontainer/configs/namespaces_linux.go index 5740fb794..f95090046 100644 --- a/libcontainer/configs/namespaces_linux.go +++ b/libcontainer/configs/namespaces_linux.go @@ -3,6 +3,7 @@ package configs import ( "fmt" "os" + "slices" "sync" ) @@ -98,7 +99,7 @@ func (n *Namespaces) Remove(t NamespaceType) bool { if i == -1 { return false } - *n = append((*n)[:i], (*n)[i+1:]...) + *n = slices.Delete((*n), i, i+1) return true }