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

Issues generating multiple files from same package #41

Open
MSalopek opened this issue Mar 14, 2018 · 7 comments
Open

Issues generating multiple files from same package #41

MSalopek opened this issue Mar 14, 2018 · 7 comments

Comments

@MSalopek
Copy link

MSalopek commented Mar 14, 2018

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.

@MSalopek MSalopek reopened this Mar 14, 2018
@MSalopek MSalopek changed the title Issues generating when generating multiple files from same package Issues generating multiple files from same package Mar 14, 2018
@awalterschulze
Copy link
Member

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

@MSalopek
Copy link
Author

MSalopek commented Mar 14, 2018

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

@awalterschulze
Copy link
Member

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

@con-ji
Copy link

con-ji commented Jun 7, 2018

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
Copy link
Member

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
Copy link

con-ji commented Jun 8, 2018

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
Copy link
Member

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.

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

3 participants