goprotowrap icon indicating copy to clipboard operation
goprotowrap copied to clipboard

Example usage/package structure

Open jeffrand opened this issue 8 years ago • 11 comments

I'm interested in using this, but I'm not really sure how my proto files should be organized. I'm getting the error:

Error: proto file "<the file>" must have a lexicographical prefix of one of the import directories

Can you update the readme with some examples?

jeffrand avatar Jul 22 '17 12:07 jeffrand

I'm hitting the same issue. Could anybody please give an example.

yathindra avatar Aug 13 '17 19:08 yathindra

Here's how I use it. We have our .proto files in a directory like this:

protos/
protos/base.proto
protos/foo/foo.proto
protos/bar/bar.proto

Then we run: protowrap --go_out=tmp/ -I.

jeffrand avatar Aug 13 '17 21:08 jeffrand

Still not working. I have a similar setup and I have the same error. Plus you're missing the proto files in your command (which when you add it on the command, generates an error). Would it be possible to make your exemple a little bit more complete ? That'd be really helpful. Thanks,

nikkolasg avatar Mar 27 '18 14:03 nikkolasg

@nikkolasg can you share your .proto files and the command you're running? I ended up figuring out how to get this to work through trial and error, maybe I can help.

jeffrand avatar Mar 27 '18 17:03 jeffrand

@jeffrand My folder structure:

.
├── a.proto
├── b.proto
├── c.proto
└── ddd
    └── d.proto

I tried run the command like your example: protowrap --go_out=tmp/ -I.

but always get same error: Error: at least one input .proto file is required

Any suggestions?

kunwang0916 avatar May 08 '18 23:05 kunwang0916

Sorry for the late response. Try:

protowrap --go_out=tmp/ -I. */*.proto

jeffrand avatar May 22 '18 13:05 jeffrand

@jeffrand Thanks, I found the reason is that Go is much stricter than other languages, the folder structure should match the package naming structure, otherwise, the compile would fail.

kunwang0916 avatar May 23 '18 03:05 kunwang0916

|--a
     |--a.proto
|--b
     |--b.proto

in b.proto,I will import a/a.proto; I use protowrap --go_out=tmp/ -I. /.proto to generate go code. Then I fetch an Error: proto file "" must have a lexicographical prefix of one of the import directories.

joyang1 avatar Mar 28 '19 04:03 joyang1

@jeffrand are you fixed Error: proto file "" must have a lexicographical prefix of one of the import directories?

joyang1 avatar Mar 28 '19 07:03 joyang1

I’m guessing that’s because it’s thinks there's a file that doesn't have proper name? I'm pretty stumped but it might be worth writing a test for it.

On Thu, Mar 28, 2019 at 5:03 AM Tommy Yang [email protected] wrote:

@jeffrand https://github.com/jeffrand are you fixed Error: proto file "" must have a lexicographical prefix of one of the import directories?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/square/goprotowrap/issues/6#issuecomment-477481809, or mute the thread https://github.com/notifications/unsubscribe-auth/ACckkeej4LnTb8wbRVKb-ZBxh3fwoycZks5vbHAhgaJpZM4OgKeQ .

jeffrand avatar Mar 31 '19 19:03 jeffrand

I have the same error with you; https://github.com/square/goprotowrap/issues/6#issue-244845363

joyang1 avatar Apr 01 '19 03:04 joyang1