I've been using protoc to generate golang gRPC client and server code without issues. Since I have multiple gRPC services that use the same data types, I'd like to refer to a base.proto for these types rather than copy and paste, which is extra work and may result in out of sync issues.
Here's a sample of base.proto:
syntax = "proto3";
package base;
message Empty {
}
message Label {
string Key = 1;
string Value = 2;
}
Here's a sample specific .proto:
syntax = "proto3";
import = "base.proto";
package publisher;
service ClientPublisher {
rpc Publish(stream base.Label) returns (base.Empty) {}
}
And, here's my command:
protoc -I system-client-go/ system-client-go/client/publisher.proto --go_out=plugins=grpc:system-client-go --proto_path=system-client-go/
No matter what I try, it throws this:
2019/08/01 15:31:31 protoc-gen-go: error:bad Go source code was generated: 273:7: expected type, found '.' (and 10 more errors) which corresponds to the line: rpc Publish(stream base.Label) returns (base.Empty) {}
Any ideas?