model/labels (stringlabels): use strings.Clone

Suggestion from @colega.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
pull/12304/head
Bryan Boreham 2 years ago
parent d16ce3c9bd
commit 55e7de04f8
  1. 3
      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.

Loading…
Cancel
Save