Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated code generated for GRPC client/server #101

Open
gnagel opened this issue Oct 2, 2023 · 1 comment
Open

Duplicated code generated for GRPC client/server #101

gnagel opened this issue Oct 2, 2023 · 1 comment

Comments

@gnagel
Copy link
Contributor

gnagel commented Oct 2, 2023

Hi All,
I'm running the vtproto generator on the proto below, we use both the go + go-grpc generators in addition to vtproto.

However when I run the vtproto generator it duplicates the grpc generated code.

What's the best way to deal with this type of proto to remove the duplicated code?

  1. Split the proto files into two files: messages.proto + grpc.proto?
  2. Ignore the generated gRPC types when running the vtproto generator?

Thanks!
Glenn

Single proto

Attached are the generated files: gen.zip

syntax = "proto3";

package pingpong;
option go_package = "pingpong";

service PingPongService {
  rpc Pong(PingRequest) returns (PongResponse) {}
}

message PingRequest {
  string hello = 1;
}

message PongResponse {
  string world = 1;
}

Split protos

Attached are the split generated files: gen 2.zip

messages.proto

syntax = "proto3";

package pingpong;
option go_package = "gen";

message PingRequest {
  string hello = 1;
}

message PongResponse {
  string world = 1;
}

grpc.proto

syntax = "proto3";

package pingpong;
option go_package = "gen";
import "messages.proto";

service PingPongService {
  rpc Pong(PingRequest) returns (PongResponse) {}
}
@coxley
Copy link

coxley commented Oct 2, 2023

There seems to be an unfinished and undocumented feature that gets pulled in by default, conflicting with protoc-gen-go-grpc. Should this be excluded from the default feature list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants