golang使用etcd以及go-micro时 clientv3 报错

github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
../../pkg/mod/github.com/coreos/etcd@v3.3.18+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
../../pkg/mod/github.com/coreos/etcd@v3.3.18+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
# github.com/coreos/etcd/clientv3/balancer/picker
../../pkg/mod/github.com/coreos/etcd@v3.3.18+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
../../pkg/mod/github.com/coreos/etcd@v3.3.18+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions

解决办法

一、

在你项目的go.mod中添加

replace google.golang.org/grpc => google.golang.org/grpc v1.26.0

二、

修改依赖为v1.26.0

go mod edit -require=google.golang.org/grpc@v1.26.0

下载v1.26.0版本的grpc

go get -u -x google.golang.org/grpc@v1.26.0

上一篇:hadoop balancer集群平衡介绍


下一篇:hadoop balancer平衡集群各节点数据