Files
Stephan D 62a6631b9a
All checks were successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
service backend
2025-11-07 18:35:26 +01:00

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)
}