Go-micro的依赖启动报错解决办法

  • Post author:
  • Post category:其他





Go-micro的依赖启动报错解决办法

错误:q.s.Close undefined (type quic.Session has no field or method Close)

GOROOT=D:\work\go1.14\go #gosetup
GOPATH=D:\work\GoLand\code\Go\src;D:\work\GoLand\code\Go #gosetup
D:\work\go1.14\go\bin\go.exe build -o C:\Users\xuekan\AppData\Local\Temp\___go_build_go_micro.exe go-micro #gosetup
# github.com/micro/go-micro/transport/quic
..\pkg\mod\github.com\micro\go-micro@v1.18.0\transport\quic\quic.go:54:12: q.s.Close undefined (type quic.Session has no field or method Close)
..\pkg\mod\github.com\micro\go-micro@v1.18.0\transport\quic\quic.go:121:3: unknown field 'IdleTimeout' in struct literal of type quic.Config
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
..\pkg\mod\github.com\coreos\etcd@v3.3.25+incompatible\clientv3\balancer\resolver\endpoint\endpoint.go:114:78: undefined: resolver.BuildOption
..\pkg\mod\github.com\coreos\etcd@v3.3.25+incompatible\clientv3\balancer\resolver\endpoint\endpoint.go:182:31: undefined: resolver.ResolveNowOption
# github.com/coreos/etcd/clientv3/balancer/picker
..\pkg\mod\github.com\coreos\etcd@v3.3.25+incompatible\clientv3\balancer\picker\err.go:37:44: undefined: balancer.PickOptions
..\pkg\mod\github.com\coreos\etcd@v3.3.25+incompatible\clientv3\balancer\picker\roundrobin_balanced.go:55:54: undefined: balancer.PickOptions

解决办法:在go mod 里面添加如下代码块

replace github.com/lucas-clemente/quic-go => github.com/lucas-clemente/quic-go v0.14.1

错误: undefined: resolver.BuildOption | undefined: balancer.PickOptions

# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
..\pkg\mod\github.com\coreos\etcd@v3.3.25+incompatible\clientv3\balancer\resolver\endpoint\endpoint.go:114:78: undefined: resolver.BuildOption
..\pkg\mod\github.com\coreos\etcd@v3.3.25+incompatible\clientv3\balancer\resolver\endpoint\endpoint.go:182:31: undefined: resolver.ResolveNowOption
# github.com/coreos/etcd/clientv3/balancer/picker
..\pkg\mod\github.com\coreos\etcd@v3.3.25+incompatible\clientv3\balancer\picker\err.go:37:44: undefined: balancer.PickOptions
..\pkg\mod\github.com\coreos\etcd@v3.3.25+incompatible\clientv3\balancer\picker\roundrobin_balanced.go:55:54: undefined: balancer.PickOptions

解决办法:在go mod 里面添加如下代码块

replace google.golang.org/grpc => google.golang.org/grpc v1.26.0



一起解决:

replace (
	github.com/lucas-clemente/quic-go => github.com/lucas-clemente/quic-go v0.14.1
	google.golang.org/grpc => google.golang.org/grpc v1.26.0
)



版权声明:本文为qq_24005787原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。