pkg/netutil: stop resolving in place

It helps to copy out a and b, and not modify the original a and b.
This commit is contained in:
Yicheng Qin
2015-08-21 12:09:17 -07:00
parent 059233768e
commit ccb67a691b
2 changed files with 25 additions and 11 deletions

View File

@ -124,15 +124,15 @@ func TestResolveTCPAddrs(t *testing.T) {
}
return &net.TCPAddr{IP: net.ParseIP(tt.hostMap[host]), Port: i, Zone: ""}, nil
}
err := resolveTCPAddrs(tt.urls...)
urls, err := resolveTCPAddrs(tt.urls)
if tt.hasError {
if err == nil {
t.Errorf("expected error")
}
continue
}
if !reflect.DeepEqual(tt.urls, tt.expected) {
t.Errorf("expected: %v, got %v", tt.expected, tt.urls)
if !reflect.DeepEqual(urls, tt.expected) {
t.Errorf("expected: %v, got %v", tt.expected, urls)
}
}
}