fix(metadata): sort services by lexicographical order on ListServices (#2397)

Co-authored-by: Guoqiang Ding <guoqiang10@staff.sina.com.cn>
pull/2412/head
Guoqiang Ding 2 years ago committed by GitHub
parent 6bb3ad6f27
commit 40300677ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      api/metadata/server.go

@ -7,6 +7,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"sort"
"sync" "sync"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -115,6 +116,8 @@ func (s *Server) ListServices(ctx context.Context, in *ListServicesRequest) (*Li
reply.Methods = append(reply.Methods, fmt.Sprintf("/%s/%s", name, method)) reply.Methods = append(reply.Methods, fmt.Sprintf("/%s/%s", name, method))
} }
} }
sort.Strings(reply.Services)
sort.Strings(reply.Methods)
return reply, nil return reply, nil
} }

Loading…
Cancel
Save