0

I am using protoc to try and generate a client / server for my gRPC service.

I have the following in my make file

stripe:
    @protoc --go_out=. pkg/proto/stripe/service.proto

My proto file is

syntax = "proto3";
package grpc;
option go_package = "pkg/proto/stripe/";

service Stripe {
  rpc UpdateVerification(UpdateVerificationRequest) returns (UpdateVerificationResponse);
}

message UpdateVerificationRequest {
  string id = 1;
}

message UpdateVerificationResponse {
}

When I run make stripe it generates a service.pb.go but there is no interface or client generated.

Is this something I am missing in the generation CLI command?

N P
  • 2,319
  • 7
  • 32
  • 54
  • 2
    Try with: `--go-grpc_out=.` – ipinak Dec 18 '21 at 14:49
  • Does this answer your question? [protoc-gen-go-grpc: program not found or is not executable](https://stackoverflow.com/questions/60578892/protoc-gen-go-grpc-program-not-found-or-is-not-executable) – blackgreen Dec 18 '21 at 15:19

1 Answers1

1

Try adding go-grpc_out, as example:

protoc --go_out=. --go-grpc_out=.   pkg/proto/stripe/service.proto

Will generate also the service_grpc.pb.go file in the same dir of the proto

As suggested in the quickstart giude, the full command could be:

protoc --go_out=. --go_opt=paths=source_relative \
    --go-grpc_out=. --go-grpc_opt=paths=source_relative \
    pkg/proto/stripe/service.proto

Matteo
  • 37,680
  • 11
  • 100
  • 115