onionscan/utils/remove_duplicates.go

16 lines
252 B
Go
Raw Normal View History

2016-04-10 00:04:22 +00:00
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]
}