go get 安装 go.etcd.io etcd clientv3 报错

目录

  • 问题
  • 解决办法

问题

直接使用

go get -u go.etcd.io/etcd/clientv3

安装 go etcd clientv3,直接使用go get是下载最新的代码,没有经过严格测试。

可能会遇到如下问题:

go get -u go.etcd.io/etcd/clientv3
# go.etcd.io/etcd/clientv3/balancer/picker
workspace/go_projects/src/go.etcd.io/etcd/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)
workspace/go_projects/src/go.etcd.io/etcd/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)

解决办法

下载已经发布版本的source code。

已经发布的版本相对来说比较稳定,不会遇到一些奇怪的问题。

例如,v3.4.13 ,下载地址v3.4.13。

下载后,解压到$GOPATH目录下:

tar zvxf etcd-3.4.13.tar.gz -C /home/lanyang/workspace/go_projects/src/go.etcd.io/

cd /home/lanyang/workspace/go_projects/src/go.etcd.io/
mv etcd-3.4.13/ etcd

你可能感兴趣的:(分布式,大数据,etcd)