onionscan/utils/remove_duplicates.go

16 lines
252 B
Go

package utils
// RemoveDuplicates is a utility function
func RemoveDuplicates(xs *[]string) {
found := make(map[string]bool)
j := 0
for i, x := range *xs {
if !found[x] {
found[x] = true
(*xs)[j] = (*xs)[i]
j++
}
}
*xs = (*xs)[:j]
}