etcd 依赖采坑

项目中依赖 kubernetes 做out-of-tree 开发

依赖的其他项目也用到etcd的依赖导致编译错误

 

cannot use kv (type *"github.com/coreos/etcd/mvcc/mvccpb".KeyValue) as type *"go.etcd.io/etcd/mvcc/mvccpb".KeyValue in argument to parseKV

 

确保所依赖的除kubernetes以外的项目用跟kubernetes的go.mod引用一直

在kubernetes/go.mod中

 

go.etcd.io/etcd => go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738 // 3cf2f69b5738 is the SHA for git tag v3.4.3

 

同样在依赖项目中使用此 replace 

 

附带如何查看 go mod 库的 SHA 编码 例如(v0.0.0-20191023171146-3cf2f69b5738)

 

TZ=UTC git --no-pager show \
  --quiet \
  --abbrev=12 \
  --date='format-local:%Y%m%d%H%M%S' \
  --format="%cd-%h"
posted @ 2021-04-29 16:06  xuchenCN  阅读(374)  评论(0编辑  收藏  举报