Avoid reallocs in removeDuplicateAddresses

This commit is contained in:
Tomás Senart 2014-07-02 17:14:36 +02:00 committed by Dave Collins
parent a0f20007c5
commit 76d258e2a1

View file

@ -232,7 +232,7 @@ func validDbType(dbType string) bool {
// removeDuplicateAddresses returns a new slice with all duplicate entries in
// addrs removed.
func removeDuplicateAddresses(addrs []string) []string {
var result []string
result := make([]string, 0, len(addrs))
seen := map[string]bool{}
for _, val := range addrs {
if _, ok := seen[val]; !ok {