resolver/registry: small slice optimization

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-08-29 17:43:36 +03:00
parent 622490fbf3
commit 24c20b6907

View File

@ -19,8 +19,7 @@ func (r *Resolver) Resolve(name string) ([]*resolver.Record, error) {
return nil, err return nil, err
} }
var records []*resolver.Record records := make([]*resolver.Record, 0, len(services))
for _, service := range services { for _, service := range services {
for _, node := range service.Nodes { for _, node := range service.Nodes {
records = append(records, &resolver.Record{ records = append(records, &resolver.Record{