go version go1.13.4
使用ETCD clientv3包,遇到以下错误.
使用了go mod
# 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
go.mod
google.golang.org/grpc v1.27.0
终于解决啦.需要将grpc1.27.0 替换成grpc1.26.0版本.~~~~
google.golang.org/grpc v1.27.0
替换成
google.golang.org/grpc v1.26.0
具体步骤:
rm -rf vendor
或手动删除go mod edit -require=google.golang.org/grpc@v1.26.0
go get -u -x google.golang.org/grpc@v1.26.0
go mod vendor
go build main.go