summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-26 17:44:10 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-26 17:44:10 -0600
commit1e5e0aa0ecbade7c748cf920b405635e45b1796c (patch)
tree754c1cf01e1d1652b462a04643f54e4555f8b4f0
parentbf2327276e6b3c8158a23362ca2fca5f46317e56 (diff)
wip better vol
-rw-r--r--pkg/util/generic.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/util/generic.go b/pkg/util/generic.go
index 79096ab..7ff2445 100644
--- a/pkg/util/generic.go
+++ b/pkg/util/generic.go
@@ -13,6 +13,17 @@ func InSlice[T comparable](needle T, haystack []T) bool {
return false
}
+func RemoveFromSlice[T comparable](haystack []T, needle T) []T {
+ for i, straw := range haystack {
+ if needle == straw {
+ return append(
+ haystack[:i],
+ RemoveFromSlice(haystack[i+1], item)...)
+ }
+ }
+ return haystack
+}
+
func Max[T constraints.Ordered](a, b T) T {
if a > b {
return a