【golang】解决etcd安装出现的问题

因grpc版本问题导致的报错

/opt/gocode/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
/opt/gocode/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
# github.com/coreos/etcd/clientv3/balancer/picker
/opt/gocode/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
/opt/gocode/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions

解决办法修改依赖版本:

#修改依赖
go mod edit -require=google.golang.org/[email protected]
#下载新版本
go get -u -x google.golang.org/[email protected]

因go-system导致的问题

/opt/gocode/pkg/mod/github.com/coreos/[email protected]+incompatible/pkg/logutil/zap_journal.go:29:2: no matching versions for query "latest"

在GOPATH/src下执行

git clone https://github.com/coreos/go-systemd.git

在go mod里加入

replace github.com/coreos/go-systemd =>${自己的PATH路径}/github.com/go-systemd

你可能感兴趣的:(【golang】解决etcd安装出现的问题)