fix GrowJust() not returning slice of same length

This commit is contained in:
kim 2024-11-08 14:33:38 +00:00
parent 3431474b2e
commit 7b26b62a04

View file

@ -29,7 +29,7 @@
// may allocate more than necessary extra size.
func GrowJust[T any](in []T, size int) []T {
if cap(in)-len(in) < size {
in2 := make([]T, len(in)+size)
in2 := make([]T, len(in), len(in)+size)
_ = copy(in2, in)
in = in2
}