Following this example of using go-micro. When I do a go mod init github.com/username/blahblah
followed by a go get -u I get this in my go.mod file:
require (
github.com/coreos/etcd v3.3.21+incompatible // indirect
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/protobuf v1.4.2
github.com/imdario/mergo v0.3.9 // indirect
github.com/micro/go-micro/v2 v2.7.0
github.com/miekg/dns v1.1.29 // indirect
github.com/nats-io/nats.go v1.10.0 // indirect
go.uber.org/zap v1.15.0 // indirect
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 // indirect
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 // indirect
golang.org/x/tools v0.0.0-20200520220537-cf2d1e09c845 // indirect
google.golang.org/genproto v0.0.0-20200519141106-08726f379972 // indirect
google.golang.org/grpc v1.29.1 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
)
It fails with this message:
go: finding github.com/jbenet/go-context latest
go: finding go.uber.org/tools latest
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
../../../../../go3p/pkg/mod/github.com/coreos/etcd@v3.3.21+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
../../../../../go3p/pkg/mod/github.com/coreos/etcd@v3.3.21+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
# github.com/coreos/etcd/clientv3/balancer/picker
../../../../../go3p/pkg/mod/github.com/coreos/etcd@v3.3.21+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
../../../../../go3p/pkg/mod/github.com/coreos/etcd@v3.3.21+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions
Attempting to build with go build main.go
fails with the same message.
This looks like .jar hell from Java. The culprit is go get
. Is there a way to make go get
resolve this problem?
Its a bug with version inconsistency between go-micro and grpc. About a week ago I tried to follow the tutorial which you mention and got same error. If you want to fix the error above please follow the interactions below the link: https://github.com/etcd-io/etcd/issues/11563.
In additionally I recommend you just build grpc service without go-micro, due to version inconsistency.