From 394fb7bb5b3622a1c8679cd28ce5160b5481c437 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Thu, 3 Oct 2024 15:32:08 +0800 Subject: [PATCH] Correct slice capacity initialisation intent len(unique) is always 0 as it's a map; intent is to initialise the slice with capacity that assumes there are no duplicates/empty elements. Avoid scanning/linting tools from continuing to suggest useless changes that have no effect. Signed-off-by: Chad Wilson --- cmd/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/list.go b/cmd/list.go index 904670bd8..d72f1e224 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -125,7 +125,7 @@ func appendTags(s []string, tags *gauge.Tags) []string { func uniqueNonEmptyElementsOf(input []string) []string { unique := make(map[string]bool, len(input)) - us := make([]string, len(unique)) + us := make([]string, 0, len(input)) for _, elem := range input { if len(elem) != 0 && !unique[elem] { us = append(us, elem)