mirror of https://github.com/databricks/cli.git
14 lines
304 B
Go
14 lines
304 B
Go
|
package filer
|
||
|
|
||
|
import "golang.org/x/exp/slices"
|
||
|
|
||
|
// sliceWithout returns a copy of the specified slice without element e, if it is present.
|
||
|
func sliceWithout[S []E, E comparable](s S, e E) S {
|
||
|
s_ := slices.Clone(s)
|
||
|
i := slices.Index(s_, e)
|
||
|
if i >= 0 {
|
||
|
s_ = slices.Delete(s_, i, i+1)
|
||
|
}
|
||
|
return s_
|
||
|
}
|