mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-06 14:17:12 +02: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 {
|
func resize[T any](items []T, n int) []T {
|
||||||
if len(items) < n {
|
if cap(items) < n {
|
||||||
return make([]T, n)
|
return make([]T, n)
|
||||||
}
|
}
|
||||||
return items[:n]
|
return items[:n]
|
||||||
|
Loading…
Reference in New Issue
Block a user