specify array capacity hints (#2299)

pull/2302/head
过客龙门 2 years ago committed by GitHub
parent b1bb0bd18f
commit 0ce9e8d069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      api/metadata/server.go

@ -105,7 +105,10 @@ func (s *Server) ListServices(ctx context.Context, in *ListServicesRequest) (*Li
if err := s.load(); err != nil { if err := s.load(); err != nil {
return nil, err return nil, err
} }
reply := new(ListServicesReply) reply := &ListServicesReply{
Services: make([]string, 0, len(s.services)),
Methods: make([]string, 0, len(s.methods)),
}
for name := range s.services { for name := range s.services {
reply.Services = append(reply.Services, name) reply.Services = append(reply.Services, name)
} }

Loading…
Cancel
Save