diff --git a/pkg/util/tools.go b/pkg/util/tools.go index 1a4ab524..ff1dd1f0 100644 --- a/pkg/util/tools.go +++ b/pkg/util/tools.go @@ -6,11 +6,8 @@ package util import ( "encoding/hex" - "os" - "os/exec" "regexp" "sort" - "strings" ) var isHexa = regexp.MustCompile("^[0-9A-Fa-f]+$") @@ -38,3 +35,10 @@ func RemoveDuplicate[T comparable](inlist []T) []T { } return list } + +func InSlice(item string, slice []string) bool { + sort.Strings(slice) + i := sort.SearchStrings(slice, item) + return i < len(slice) && slice[i] == item +} +