From 40300677eef9d50ec85bc406ce4d787c95f2a79c Mon Sep 17 00:00:00 2001 From: Guoqiang Ding Date: Tue, 18 Oct 2022 20:23:39 +0800 Subject: [PATCH] fix(metadata): sort services by lexicographical order on ListServices (#2397) Co-authored-by: Guoqiang Ding --- api/metadata/server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/metadata/server.go b/api/metadata/server.go index 3600fc14e..b1c4c17b2 100644 --- a/api/metadata/server.go +++ b/api/metadata/server.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "io" + "sort" "sync" "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)) } } + sort.Strings(reply.Services) + sort.Strings(reply.Methods) return reply, nil }