BoyChai's Blog - ETCD https://blog.boychai.xyz/index.php/tag/ETCD/ [ETCD]依赖报错 https://blog.boychai.xyz/index.php/archives/76/ 2024-07-13T16:04:00+00:00 报错1在go环境安装etcd时执行下面操作go get go.etcd.io/etcd/client/v3 go mod tidy在tidy的过程中出现下面错误go: etcd-client/etcd imports go.etcd.io/etcd/clientv3 tested by go.etcd.io/etcd/clientv3.test imports github.com/coreos/etcd/auth imports github.com/coreos/etcd/mvcc/backend imports github.com/coreos/bbolt: github.com/coreos/bbolt@v1.3.10: parsing go.mod: module declares its path as: go.etcd.io/bbolt but was required as: github.com/coreos/bbolt参考ISSUE,应该是这个库本来在github后来迁移到go.etcd.io了,解决办法是在go.mod后面追加replace github.com/coreos/bbolt => go.etcd.io/bbolt v1.3.5报错2解决bbolt库的问题之后再次tidy出现下面这个报错,go: etcd-client/etcd imports go.etcd.io/etcd/clientv3 tested by go.etcd.io/etcd/clientv3.test imports github.com/coreos/etcd/integration imports github.com/coreos/etcd/proxy/grpcproxy imports google.golang.org/grpc/naming: module google.golang.org/grpc@latest found (v1.65.0), but does not contain package google.golang.org/grpc/naming参考ISSUE,问题是因为这些库依赖于google.golang.org/grpc/naming这个包但是他这个grcp版本v1.65.0里面移除了这个包需要一个支持naming包的grpc版本,解决办法是把grpc版本换成v1.26.0replace google.golang.org/grpc => google.golang.org/grpc v1.26.0