I'm trying to use https://github.com/grpc-ecosystem/grpc-gateway
to enable my go grpc methods to be available to be called by http as well. To that end I'm using the module https://github.com/grpc-ecosystem/grpc-gateway
. However when I generate the proto files using protoc I dont see a method Register*FromEndpoint
as shown in the example. This is what my .proto file looks like
syntax = "proto3";
package health;
option go_package = "github.com/user/app/api/health";
import "google/api/annotations.proto";
service Health {
rpc Ping (HealthRequest) returns (HealthReply) {
option (google.api.http) = {
get: "/ping"
};
}
}
// The request message containing the user's name
message HealthRequest {
}
// The response message containing the greetings
message HealthReply {
string message = 1;
}
This is what my protoc command looks like
protoc --go_out=api/proto/ --go_opt=paths=source_relative \
--go-grpc_out=./api/proto --go-grpc_opt=paths=source_relative \
--proto_path=internal/api \
--proto_path=third_party \
./internal/api/health/health.proto
The generation works fine without any errors, but the generated health_grpc.pb.go
file does not have the equivalent RegisterYourServiceHandlerFromEndpoint
method as shown in the example here https://github.com/grpc-ecosystem/grpc-gateway
protoc
options don't appear to include the flags to trigger gRPC-Gateway code generation e.g.--grpc-gateway_opt logtostderr=true --grpc-gateway_opt paths=source_relative
(this is covered at the top of step 4 in the usage instructions). – Brits