johanbrandhorst / grpc-gateway-boilerplate

All the boilerplate you need to get started with writing grpc-gateway powered REST services in Go
MIT License
479 stars 83 forks source link

Incompatibility with the new Go ProtoReflect API #13

Closed keelerh closed 4 years ago

keelerh commented 4 years ago

Hi - great project! Unfortunately, I'm hitting a blocker when I try to get your project up and running:

$ go run main.go
go: finding golang.org/x/net v0.0.0-20191002035440-2ec189313ef0
# github.com/johanbrandhorst/grpc-gateway-boilerplate/proto
proto/example.pb.gw.go:45:2: cannot use msg (type *User) as type protoreflect.ProtoMessage in return argument:
    *User does not implement protoreflect.ProtoMessage (missing ProtoReflect method)
proto/example.pb.gw.go:62:2: cannot use msg (type *User) as type protoreflect.ProtoMessage in return argument:
    *User does not implement protoreflect.ProtoMessage (missing ProtoReflect method)
proto/example.pb.gw.go:192:104: cannot use *User value as type protoreflect.ProtoMessage in return argument:
    *User does not implement protoreflect.ProtoMessage (missing ProtoReflect method)

It seems like this may be an issue with the new Go API for Protocol Buffers? I'm not sure if this is a version incompatibility issue with the versions specified in go.mod or if I'm perhaps using the wrong version of protoc?

$ protoc --version
libprotoc 3.11.2

Any thoughts would be very much appreciated!

johanbrandhorst commented 4 years ago

Hi Keeley, thanks for your interest in the project! I'm a little confused, as I updated to the new version 2 weeks ago. Are you running this on the master branch? You can see here that it does indeed implement the new protoreflect API: https://github.com/johanbrandhorst/grpc-gateway-boilerplate/blob/master/proto/example.pb.go#L133. If this is a issue when you're generating the files locally, make sure you've reinstalled to the latest version of protoc-gen-go by running make install.

Let me know if you're still having issues with it.