refactor fstree to separate package
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package utils
|
||||
|
||||
// Removes the first occurence from the slice. Worst case O(n)
|
||||
func RemoveFromSlice[T comparable](slice []T, item T) []T {
|
||||
for i, v := range slice {
|
||||
if v == item {
|
||||
return append(slice[:i], slice[i+1:]...)
|
||||
}
|
||||
}
|
||||
return slice
|
||||
}
|
||||
Reference in New Issue
Block a user