3

We are using protoc-gen-go v2 (v2 is google.golang.org/protobuf, v1 is github.com/golang/protobuf)

When we are trying to compile our gRPC services, it tells us that plugins is not supported anymore and we should instead use --go-grpc_out:

$ protoc --go_out=plugins=grpc:. *.proto
--go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC

And when using --go-grpc_out, it is telling us we need the protoc-gen-go-rpc:

$ protoc --go-rpc_out=. *.proto
protoc-gen-go-rpc: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable

Where do you find, or how do you install protoc-gen-go-rpc?

Update: We also just found this post on Reddit for additional information https://www.reddit.com/r/golang/comments/fe3a4k/documentation_on_getting_grpc_working_with_the/

corgrath
  • 11,673
  • 15
  • 68
  • 99

1 Answers1

0

I'm not sure about protoc-gen-go v2, because the latest protobuf tag I can see is v1.4.

Here is the example how we call protoc to generate source code for sevice called crab that has no external dependencies (e.g. no external protofile imports). The only binary dependency is protoc-gen-go

protoc -I $(pwd) -I /home/isaev/go/src \
 $(pwd)/crab/error_codes.proto \
 $(pwd)/crab/goproxy.proto \
 $(pwd)/crab/crab.proto \
 --go_out=plugins=grpc:/tmp/crab
Vitaly Isaev
  • 5,392
  • 6
  • 45
  • 64
  • Hey, yes. Since you use "plugins", you are still using an old version of protocol-gen-go https://github.com/protocolbuffers/protobuf-go/releases/tag/v1.20.0#v1.20-grpc-support – corgrath Apr 22 '20 at 12:07