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

 2020-10-23 

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

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

1
2
3
4
5
6
7
8
9
10
11
12
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 里面添加如下代码块

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

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

1
2
3
4
5
6
# 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 里面添加如下代码块

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

一起解决:

1
2
3
4
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
)