fix: remove unused import, add missing InSlice.

This commit is contained in:
Alexandre Pujol 2023-04-16 23:42:15 +01:00
parent 57ee9f54c4
commit 22b12fade0
Failed to generate hash of commit

View file

@ -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
}