# go.etcd.io/etcd/clientv3/balancer/picker
E:\Go\pkg\mod\go.etcd.io\etcd@v0.0.0-20200402134248-51bdeb39e698\clientv3\balancer\picker\err.go:25:9: cannot use &errPicker literal (type *errPicker) as type Picker in return argument:
*errPicker does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
E:\Go\pkg\mod\go.etcd.io\etcd@v0.0.0-20200402134248-51bdeb39e698\clientv3\balancer\picker\roundrobin_balanced.go:33:9: cannot use &rrBalanced literal (type *rrBalanced) as type Picker in return argument:
*rrBalanced does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
# github.com/tal-tech/go-zero/zrpc/internal/balancer/p2c
E:\Go\pkg\mod\github.com\tal-tech\go-zero@v1.1.5\zrpc\internal\balancer\p2c\p2c.go:43:32: not enough arguments in call to base.NewBalancerBuilder
have (string, *p2cPickerBuilder)
want (string, base.PickerBuilder, base.Config)
E:\Go\pkg\mod\github.com\tal-tech\go-zero@v1.1.5\zrpc\internal\balancer\p2c\p2c.go:60:9: cannot use &p2cPicker literal (type *p2cPicker) as type balancer.Picker in return argument:
*p2cPicker does not implement balancer.Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
原因就是ETCD的毒
解决办法
go.mod 最后添加一行
replace google.golang.org/grpc => google.golang.org/grpc v1.29.1
在使用Go语言开发时,遇到了Etcd客户端库与gRPC库之间的版本不兼容问题,导致编译错误。错误信息涉及到`go.etcd.io/etcd/clientv3/balancer/picker`和`github.com/tal-tech/go-zero/zrpc/internal/balancer/p2c`等模块。解决方案是在go.mod文件末尾添加一行`replace google.golang.org/grpc => google.golang.org/grpcv1.29.1`来替换gRPC的版本。这表明项目中的gRPC版本需要与Etcd和zrpc库兼容的特定版本。

被折叠的 条评论
为什么被折叠?



