From 55e7de04f8b60e15a4d1e3e54833da1d91c05316 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 1 Feb 2024 18:49:24 +0000 Subject: [PATCH] model/labels (stringlabels): use strings.Clone Suggestion from @colega. Signed-off-by: Bryan Boreham --- model/labels/labels_stringlabels.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/model/labels/labels_stringlabels.go b/model/labels/labels_stringlabels.go index 9ac4e4650..d284cb03c 100644 --- a/model/labels/labels_stringlabels.go +++ b/model/labels/labels_stringlabels.go @@ -188,8 +188,7 @@ func (ls Labels) BytesWithoutLabels(buf []byte, names ...string) []byte { // Copy returns a copy of the labels. func (ls Labels) Copy() Labels { - buf := append([]byte{}, ls.data...) - return Labels{data: yoloString(buf)} + return Labels{data: strings.Clone(ls.data)} } // Get returns the value for the label with the given name.