From e0b95db496b664a2df53977cd72d52217b63fb2a Mon Sep 17 00:00:00 2001 From: Gadzhi Kharkharov Date: Thu, 16 Sep 2021 17:39:50 +0300 Subject: [PATCH] allocate ready-to-use slice of session in list cmd --- cmd/list.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/list.go b/cmd/list.go index 8b800c0..7f8cde7 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -41,11 +41,11 @@ func (c *ListCmd) Run() error { Dir string `json:"dir"` } - sessions := []session{} + sessions := make([]session, len(kakSessions)) for i, s := range kakSessions { d, err := s.Dir() - sessions = append(sessions, session{Name: s.Name, Clients: []string{}, Dir: d}) + sessions[i] = session{Name: s.Name, Clients: []string{}, Dir: d} c, err := s.Clients() for _, c := range c {