balancers.PreferLocations should be pure function and not modify the slice.
func PreferLocations(balancer *balancerConfig.Config, locations ...string) *balancerConfig.Config {
if len(locations) == 0 {
panic("empty list of locations")
}
for i := range locations { // need to copy the slice
locations[i] = strings.ToUpper(locations[i])
}
sort.Strings(locations)
balancer.Filter = filterLocations(locations)
return balancer
}
balancers.PreferLocations should be pure function and not modify the slice.