gogo / letmegrpc

[maintainer wanted] generates a web form gui from a grpc specification
BSD 3-Clause "New" or "Revised" License
419 stars 50 forks source link

Issues generating multiple files from same package #41

Open MSalopek opened 6 years ago

MSalopek commented 6 years ago

Hi, Conflicts happen after generating separate files that are a part of the same package. Such generated files have functions and variables with the same name which causes issues.

Example: Lets say I have 2 files in "package example" named ex1.proto and ex2.proto. When I run protoc --letmegrpc (...) I get var Header, var Footer, and function func NewHandler defined in both ex1.letmegrpc.go and ex2.letmegrpc.go which causes issues.

I may have a workaround for this issue.

awalterschulze commented 6 years ago

Have you tried passing both ex1.proto and ex2.proto to letmegrpc at the same time?

MSalopek commented 6 years ago

Yes. I pass it like this: protoc --letmegrpc_out=./internal/types -I $(pwd)/protos $(pwd)/protos/*

awalterschulze commented 6 years ago

Damn, my bad, I never ran into this use case. Good catch, thanks for reporting and fixing :)

con-ji commented 6 years ago

Is there a solution to this yet?

I have one .proto which wraps around the other in the same package, but attempting to compile both with gogo and the wrapper with letmegrpc makes it say no Go files in /usr/lib/golang/src/protos

awalterschulze commented 6 years ago

Hmmm, I wonder why I thought this was fixed. It seems it is not.

A pull request to fix this would be most welcome

con-ji commented 6 years ago

My bad, it seems to work fine when invoking protoc with the proper paths set. I was able to work around the repeated fields by only compiling the main .proto with --letmegrpc_out, then removing the import import _ ".". It's a little bit hacky, but it works.

awalterschulze commented 6 years ago

Ooo yeah that is quite hacky. We are very open to a pull request for a fix. But either way thanks for sharing the work around.