使用go-micro/etcd 报错undefined: resolver.BuildOption resolver.ResolveNowOption balancer.PickOptions...

使用go-micro/etcd 报错undefined: resolver.BuildOption resolver.ResolveNowOption balancer.PickOptions..._第1张图片
如图, 在写完简单的demo文件后,发现报错了。

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

在网上找到答案,原来是因为最新的grpc1.27和clientV3版本不兼容的问题
解决办法
把grpc版本降低到1.26或以下便可,简单办法即修改go.mod文件

module github.com/luslin/tools

go 1.13

require (
	github.com/golang/protobuf v1.4.0
	github.com/micro/cli/v2 v2.1.2
	github.com/micro/go-micro/v2 v2.7.0
	google.golang.org/grpc v1.26.0
)

你可能感兴趣的:(go,后端,错误,go,etcd)