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:
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user