diff --git a/pkg/commands/podman.go b/pkg/commands/podman.go index 6a607fa3..7db51a82 100644 --- a/pkg/commands/podman.go +++ b/pkg/commands/podman.go @@ -402,7 +402,8 @@ func (c *PodmanCommand) RefreshContainersAndServices(currentServices []*Service, // buildContainerListItems creates a unified list of pods and containers func (c *PodmanCommand) buildContainerListItems(containers []*Container, podSummaries []PodSummary) []*ContainerListItem { - var items []*ContainerListItem + // Pre-allocate: pods + containers (max possible size) + items := make([]*ContainerListItem, 0, len(podSummaries)+len(containers)) // Create a map of pod ID -> pod summary podMap := make(map[string]PodSummary) diff --git a/pkg/gui/presentation/containers.go b/pkg/gui/presentation/containers.go index 2d74ccdc..c96486f8 100644 --- a/pkg/gui/presentation/containers.go +++ b/pkg/gui/presentation/containers.go @@ -6,10 +6,10 @@ import ( "strconv" "strings" - "github.com/fatih/color" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" "github.com/samber/lo" ) @@ -47,10 +47,10 @@ func GetContainerListItemDisplayStrings(guiConfig *config.GuiConfig, item *comma func GetPodDisplayStrings(guiConfig *config.GuiConfig, pod *commands.Pod) []string { return []string{ getPodDisplayStatus(guiConfig, pod), - "", // No substatus for pods + "", // No substatus for pods utils.ColoredString(pod.Name, color.FgCyan), - "", // No CPU% for pods - "", // No ports for pods + "", // No CPU% for pods + "", // No ports for pods utils.ColoredString(fmt.Sprintf("(%d containers)", len(pod.Containers)), color.FgMagenta), } }