gogo / letmegrpc

[maintainer wanted] generates a web form gui from a grpc specification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues generating multiple files from same package

MSalopek opened this issue · comments

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.

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

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

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

commented

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

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

A pull request to fix this would be most welcome

commented

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.

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.