mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-17 06:00:15 +02:00
Maintenance: unique choices from hardcoded servers
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package constants
|
||||
|
||||
import "sort"
|
||||
|
||||
func makeUnique(slice []string) (uniques []string) {
|
||||
set := make(map[string]struct{}, len(slice))
|
||||
for _, element := range slice {
|
||||
set[element] = struct{}{}
|
||||
}
|
||||
|
||||
uniques = make([]string, 0, len(set))
|
||||
for element := range set {
|
||||
uniques = append(uniques, element)
|
||||
}
|
||||
|
||||
sort.Slice(uniques, func(i, j int) bool {
|
||||
return uniques[i] < uniques[j]
|
||||
})
|
||||
|
||||
return uniques
|
||||
}
|
||||
Reference in New Issue
Block a user