summaryrefslogtreecommitdiff
path: root/pkg/util
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
commite6b7c243462b1412390d0048dafe3430d07c05be (patch)
tree982dbe764802585ff0935a904f53378b1d6da555 /pkg/util
parent6a1b5c780b8fbb9ca0285286036096960458d4e6 (diff)
wip better vol
Diffstat (limited to 'pkg/util')
-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