aboutsummaryrefslogtreecommitdiff
path: root/go/utils
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-08 17:50:10 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:49 +0100
commit805cbf397589e5cb861f866713c2eb4bec9ce40b (patch)
tree084ef7d136f33b87efe5aa02c7401bde50c9d251 /go/utils
parent05de94b9d97079ca9a7b23e011516f55056472b3 (diff)
downloadmuhqs-game-805cbf397589e5cb861f866713c2eb4bec9ce40b.tar.gz
muhqs-game-805cbf397589e5cb861f866713c2eb4bec9ce40b.zip
intermediate commit
Diffstat (limited to 'go/utils')
-rw-r--r--go/utils/slices.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/go/utils/slices.go b/go/utils/slices.go
index d2bc04c1..3cc38c1c 100644
--- a/go/utils/slices.go
+++ b/go/utils/slices.go
@@ -7,3 +7,11 @@ func TypedSliceToInterfaceSlice[T any](s []T) []interface{} {
}
return is
}
+
+func InterfaceSliceToTypedSlice[T any](s []interface{}) []T {
+ ts := make([]T, 0, len(s))
+ for _, t := range s {
+ ts = append(ts, t.(T))
+ }
+ return ts
+}