MCPcopy
hub / github.com/grafana/tempo / Clone

Function Clone

pkg/util/slices.go:6–12  ·  view source on GitHub ↗

Clone returns a copy of the slice. The elements are copied using assignment, so this is a shallow clone. The difference with slices.Clone is that the result will not have additional unused capacity.

(s S)

Source from the content-addressed store, hash-verified

4// The elements are copied using assignment, so this is a shallow clone.
5// The difference with slices.Clone is that the result will not have additional unused capacity.
6func Clone[S ~[]E, E any](s S) S {
7 // Preserve nilness in case it matters.
8 if s == nil {
9 return nil
10 }
11 return append(make(S, 0, len(s)), s...)
12}

Callers 3

KeepGroupMethod · 0.92
KeepGroupMethod · 0.92
ResultMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected