From 3c3d32718f18f26af4660eab4184feaa7407f700 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 5 Feb 2026 16:43:29 -0800 Subject: [PATCH] libpod: do not reuse names slice Do not reuse names slice for the unrelated data. This fixes the following prealoc warning: > libpod/storage.go:109:2: Consider preallocating names with capacity 2 (prealloc) > names := []string{containerName} > ^ This commit is part of series fixing issues reported by prealloc linter from golangci-lint v2.8.0. Signed-off-by: Kir Kolyshkin --- libpod/storage.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libpod/storage.go b/libpod/storage.go index 50d3fd9969..a7e4efd2d8 100644 --- a/libpod/storage.go +++ b/libpod/storage.go @@ -106,9 +106,7 @@ func (r *storageService) CreateContainerStorage(ctx context.Context, systemConte } // Build the container. - names := []string{containerName} - - container, err := r.store.CreateContainer(containerID, names, imageID, "", string(mdata), &options) + container, err := r.store.CreateContainer(containerID, []string{containerName}, imageID, "", string(mdata), &options) if err != nil { logrus.Debugf("Failed to create container %s(%s): %v", metadata.ContainerName, containerID, err) @@ -132,7 +130,7 @@ func (r *storageService) CreateContainerStorage(ctx context.Context, systemConte // Add a name to the container's layer so that it's easier to follow // what's going on if we're just looking at the storage-eye view of things. layerName := metadata.ContainerName + "-layer" - names, err = r.store.Names(container.LayerID) + names, err := r.store.Names(container.LayerID) if err != nil { return ContainerInfo{}, err }