From 22b12fade02d50faf2f8f48b8800b253d30cef19 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Sun, 16 Apr 2023 23:42:15 +0100 Subject: [PATCH] fix: remove unused import, add missing InSlice. --- pkg/util/tools.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 +} +