Merge pull request #4914 from osamakader/fix-stringsTitle-criu-linux

criu: replace deprecated strings.Title
This commit is contained in:
lfbzhm
2025-10-13 17:33:16 +08:00
committed by GitHub
+14 -1
View File
@@ -15,6 +15,7 @@ import (
"reflect"
"strings"
"time"
"unicode"
"github.com/checkpoint-restore/go-criu/v7"
criurpc "github.com/checkpoint-restore/go-criu/v7/rpc"
@@ -183,7 +184,19 @@ func (c *Container) criuSupportsExtNS(t configs.NamespaceType) bool {
}
func criuNsToKey(t configs.NamespaceType) string {
return "extRoot" + strings.Title(configs.NsName(t)) + "NS" //nolint:staticcheck // SA1019: strings.Title is deprecated
// Construct "extRoot" + capitalize(nsName) + "NS" without allocations.
// Result format: "extRootNetNS", "extRootPidNS", etc.
nsName := configs.NsName(t)
out := make([]byte, 0, 32)
out = append(out, "extRoot"...)
// Capitalize the first character (this assumes it's in the a-z range).
if len(nsName) > 0 {
out = append(out, byte(unicode.ToUpper(rune(nsName[0]))))
out = append(out, nsName[1:]...)
}
out = append(out, "NS"...)
return string(out)
}
func (c *Container) handleCheckpointingExternalNamespaces(rpcOpts *criurpc.CriuOpts, t configs.NamespaceType) error {