mirror of
https://github.com/containers/podman.git
synced 2026-03-13 08:01:19 +08:00
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 <kolyshkin@gmail.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user