Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This process seems to generate conflicting code with go-micro #440

Closed
EwanValentine opened this issue Jul 19, 2017 · 3 comments
Closed

This process seems to generate conflicting code with go-micro #440

EwanValentine opened this issue Jul 19, 2017 · 3 comments

Comments

@EwanValentine
Copy link

I'm using go-micro to generate gRPC code, using their custom protoc tool. However, when I generate my gRPC stub using go-micro, then attempt to generate a restful proxy using this library, I get a few conflicting errors.

./models.pb.gw.go:53: cannot use grpc.Header(&metadata.HeaderMD) (type grpc.CallOption) as type client.CallOption in argument to client.Get
./models.pb.gw.go:53: cannot use grpc.Trailer(&metadata.TrailerMD) (type grpc.CallOption) as type client.CallOption in argument to client.Get
./models.pb.gw.go:70: cannot use grpc.Header(&metadata.HeaderMD) (type grpc.CallOption) as type client.CallOption in argument to client.GetAll
./models.pb.gw.go:70: cannot use grpc.Trailer(&metadata.TrailerMD) (type grpc.CallOption) as type client.CallOption in argument to client.GetAll
./models.pb.gw.go:83: cannot use grpc.Header(&metadata.HeaderMD) (type grpc.CallOption) as type client.CallOption in argument to client.Post
./models.pb.gw.go:83: cannot use grpc.Trailer(&metadata.TrailerMD) (type grpc.CallOption) as type client.CallOption in argument to client.Post
./models.pb.gw.go:114: cannot use grpc.Header(&metadata.HeaderMD) (type grpc.CallOption) as type client.CallOption in argument to client.Patch
./models.pb.gw.go:114: cannot use grpc.Trailer(&metadata.TrailerMD) (type grpc.CallOption) as type client.CallOption in argument to client.Patch
./models.pb.gw.go:141: cannot use grpc.Header(&metadata.HeaderMD) (type grpc.CallOption) as type client.CallOption in argument to client.Delete
./models.pb.gw.go:173: RegisterMenusHandler redeclared in this block
	previous declaration at ./models.pb.go:598
./models.pb.gw.go:141: too many errors

I've checked through the generated code and go-micro does generate a RegisterMenusHandler within the same package unfortunately.

Have you come across this issue before? Or used go-micro at all? Just wondered if anyone has found a way around this?

Thanks in advance!

@achew22
Copy link
Collaborator

achew22 commented Jul 24, 2017

Our project is only set up to support golang/protobuf and gogo/gogoproto directly. It sounds like go-micro isn't exposing all the functionality grpc-gateway needs to work. Maybe you could extend go-micro to expose that information? I'm going to close this since it doesn't seem like an issue with grpc-gateway directly.

@achew22 achew22 closed this as completed Jul 24, 2017
@cappuccino5
Copy link

I also encounter this kind of problem, how to solve? thank!

.pb.gw.go:43:91: cannot use &metadata.TrailerMD (type *"google. golang.org/grpc/metadata".MD) as type *"win-his/vendor/google.golang.org/grpc/me tadata".MD in argument to grpc.Trailer

@johanbrandhorst
Copy link
Collaborator

This is a vendor problem. You've got one version of the metadata package in vendor and another version in the GOPATH. Easiest thing is to remove the package in the GOPATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants