github.com/databricks/cli@v0.203.0/libs/filer/slice.go (about)

     1  package filer
     2  
     3  import "golang.org/x/exp/slices"
     4  
     5  // sliceWithout returns a copy of the specified slice without element e, if it is present.
     6  func sliceWithout[S []E, E comparable](s S, e E) S {
     7  	s_ := slices.Clone(s)
     8  	i := slices.Index(s_, e)
     9  	if i >= 0 {
    10  		s_ = slices.Delete(s_, i, i+1)
    11  	}
    12  	return s_
    13  }