其他分享
首页 > 其他分享> > golang中使用 github.com/coreos/etcd/clientv3 第三方库报错

golang中使用 github.com/coreos/etcd/clientv3 第三方库报错

作者:互联网

使用go连接etcd,需要下载第三方库,即:go get go.etcd.io/etcd/clientv3 ,过程中报错如下:

github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
vendor\github.com\coreos\etcd\clientv3\balancer\resolver\endpoint\endpoint.go:114:78: undefined: resolver.BuildOption
vendor\github.com\coreos\etcd\clientv3\balancer\resolver\endpoint\endpoint.go:182:31: undefined: resolver.ResolveNowOption
github.com/coreos/etcd/clientv3/balancer/picker
vendor\github.com\coreos\etcd\clientv3\balancer\picker\err.go:37:44: undefined: balancer.PickOptions
vendor\github.com\coreos\etcd\clientv3\balancer\picker\roundrobin_balanced.go:55:54: undefined: balancer.PickOptions

原因:需要将grpc1.27.1 替换成grpc1.26.0版本
解决:此时可以点开go.mod文件,将google.golang.org/grpc v1.27.1 *// indirect*更改为 google.golang.org/grpc v1.26.0 *// indirect*。

然后再go get即可。

标签:clientv3,github,balancer,报错,coreos,etcd,go
来源: https://www.cnblogs.com/sebuntin2020/p/12527074.html