mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-12 06:17:27 -08:00
Use cap to determine slice capacity
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
This commit is contained in:
parent
10a82f87fd
commit
9008271df5
|
@ -321,7 +321,7 @@ func (h *Histogram) ToFloat(fh *FloatHistogram) *FloatHistogram {
|
|||
}
|
||||
|
||||
func resize[T any](items []T, n int) []T {
|
||||
if len(items) < n {
|
||||
if cap(items) < n {
|
||||
return make([]T, n)
|
||||
}
|
||||
return items[:n]
|
||||
|
|
Loading…
Reference in a new issue