diff options
Diffstat (limited to 'internal/util/xslices/slices.go')
| -rw-r--r-- | internal/util/xslices/slices.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/util/xslices/slices.go b/internal/util/xslices/slices.go index 1c1c159b2..44235f0ca 100644 --- a/internal/util/xslices/slices.go +++ b/internal/util/xslices/slices.go @@ -21,6 +21,16 @@ import ( "slices" ) +// ToAny converts a slice of any input type +// to the abstrace empty interface slice type. +func ToAny[T any](in []T) []any { + out := make([]any, len(in)) + for i, v := range in { + out[i] = v + } + return out +} + // GrowJust increases slice capacity to guarantee // extra room 'size', where in the case that it does // need to allocate more it ONLY allocates 'size' extra. |
