golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.64k stars 1.58k forks source link

protoc generate file grpc_pb was error #1529

Closed quyenhl16 closed 1 year ago

quyenhl16 commented 1 year ago

Hi, I got this issue. I create a file .proto image then I generate the file *grpc_pb.go with protoc. But it has some error image

( I think the *grpc_fb.go file doesn'n generate struct for SumRequest and SumResponse in my case). How can I fix this issue.

puellanivis commented 1 year ago

Golang requires two protoc plugins for generating grpc go code. https://pkg.go.dev/google.golang.org/protobuf/cmd/protoc-gen-go is what you’re missing (this generates the message structs) and https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc which is what you have (this generates the gRPC specific code, but not the underlying messages.)

quyenhl16 commented 1 year ago

Golang requires two protoc plugins for generating grpc go code. https://pkg.go.dev/google.golang.org/protobuf/cmd/protoc-gen-go is what you’re missing (this generates the message structs) and https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc which is what you have (this generates the gRPC specific code, but not the underlying messages.)

Thank you for supporting me !

puellanivis commented 1 year ago

If you’ve resolved your problem, could you go ahead and close the issue? Otherwise, we don’t know if there is anything else at issue.