11 lines
327 B
Go
11 lines
327 B
Go
package ledger
|
|
|
|
// dstSlice returns dst[:n] if capacity is enough, otherwise a new slice with capHint capacity.
|
|
// Avoids fmt/errors; tiny helper for in-place reuse when recomputing CurrentOwners.
|
|
func dstSlice[T any](dst []T, n, capHint int) []T {
|
|
if cap(dst) >= capHint {
|
|
return dst[:n]
|
|
}
|
|
return make([]T, n, capHint)
|
|
}
|