From f267afae74e2eb8c40e7f640febf26f5b6bb0878 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 20 Dec 2024 17:53:17 -0500 Subject: [PATCH] shared/api/status_code: pre-allocate statusStrings Signed-off-by: Simon Deziel --- shared/api/status_code.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/api/status_code.go b/shared/api/status_code.go index cc9f83f57607..0331c7651ec1 100644 --- a/shared/api/status_code.go +++ b/shared/api/status_code.go @@ -69,8 +69,8 @@ func StatusCodeFromString(status string) StatusCode { } // GetAllStatusCodeStrings returns a slice of all status code strings. -func GetAllStatusCodeStrings() []string { - var statusStrings []string +func GetAllStatusCodeStrings() (statusStrings []string) { + statusStrings = make([]string, 0, len(StatusCodeNames)) for _, code := range StatusCodeNames { statusStrings = append(statusStrings, code) }