1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-17 21:07:54 +02:00

fix(selector): version NodeFilter append func (#2671)

This commit is contained in:
180909 2023-02-23 18:23:32 +08:00 committed by GitHub
parent bab67facad
commit d8d231e725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@ import (
// Version is version filter.
func Version(version string) selector.NodeFilter {
return func(_ context.Context, nodes []selector.Node) []selector.Node {
newNodes := nodes[:0]
newNodes := make([]selector.Node, 0)
for _, n := range nodes {
if n.Version() == version {
newNodes = append(newNodes, n)