model/labels (stringlabels): use strings.Clone

Suggestion from @colega.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2024-02-01 18:49:24 +00:00
parent d16ce3c9bd
commit 55e7de04f8

View file

@ -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.