解决 etcd 与 grpc 不兼容问题

今天遇到了一个 Golang 的依赖问题,在一个使用了 Protobuf 的项目,引入了 Prometheus 的 Package 之后编译时发现 etcd 报错: # github.com/coreos/etcd/clientv3/balancer/resolver/endpoint ../../go/pkg/mod/github.com/coreos/etcd@v3.3.18+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption ../../go/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 ../../go/pkg/mod/github.com/coreos/etcd@v3.3.18+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions ../../go/pkg/mod/github.com/coreos/etcd@v3.3.18+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions 根据问题搜索到 issue:clientv3: grpc-go (v1.27.0) made API changes to balancer / resolver. #11563,依据里面

文章来源:

Author:WAYJAM
link:https://wayjam.me/posts/etcd-incompatible-with-grpc-v1.27.0/