1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-11-06 08:59:18 +02:00

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

Co-authored-by: Guoqiang Ding <guoqiang10@staff.sina.com.cn>
This commit is contained in:
Guoqiang Ding
2022-10-18 20:23:39 +08:00
committed by GitHub
parent 6bb3ad6f27
commit 40300677ee

View File

@@ -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
} }