mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2026-01-05 23:23:16 -06:00
fix GrowJust() not returning slice of same length
This commit is contained in:
parent
3431474b2e
commit
7b26b62a04
1 changed files with 1 additions and 1 deletions
|
|
@ -29,7 +29,7 @@ import (
|
||||||
// may allocate more than necessary extra size.
|
// may allocate more than necessary extra size.
|
||||||
func GrowJust[T any](in []T, size int) []T {
|
func GrowJust[T any](in []T, size int) []T {
|
||||||
if cap(in)-len(in) < size {
|
if cap(in)-len(in) < size {
|
||||||
in2 := make([]T, len(in)+size)
|
in2 := make([]T, len(in), len(in)+size)
|
||||||
_ = copy(in2, in)
|
_ = copy(in2, in)
|
||||||
in = in2
|
in = in2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue