wfxiang08 / goprotobuf

Automatically exported from code.google.com/p/goprotobuf
Other
0 stars 0 forks source link

protoc-gen-go: error: inconsistent package names #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. download the two .proto files attached
2. protoc --go_out=. test.proto test2.proto 
2011/05/20 17:05:54 protoc-gen-go: error: inconsistent package names: 
proto.test proto
--go_out: protoc-gen-go: Plugin failed with status code 1.

What is the expected output? What do you see instead?
import .proto file with different package work in other offical compiler. 
protoc-gen-go should do the same.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by liuyuan...@gmail.com on 20 May 2011 at 9:11

Attachments:

GoogleCodeExporter commented 9 years ago
This is correct behavior.  Like the regular Go compilers, the protocol compiler 
requires you to compile the files for a single package in each run.  You're 
asking it to compile two files from different packages. Instead, you should 
just compile proto; the import mechanism will process the other file correctly.

protoc --go_out=. test.proto

is all the command you need.

Original comment by r@golang.org on 21 May 2011 at 11:29

GoogleCodeExporter commented 9 years ago
That example should have read

protoc --go_out=. test2.proto

Original comment by r@golang.org on 21 May 2011 at 11:30

GoogleCodeExporter commented 9 years ago
even this is correct behavior why not just let the compiler to ignore the 
imported files(like other offical compilers). when there are lots of .proto 
files, what I need to do is write a script concate all of them as file name 
list to protoc. with goprotobuf, it going to need a human to analyse all those 
files and find out which file is being imported, then don't put that file in 
the file list.
please put the job to compiler, not human.

Original comment by liuyuan...@gmail.com on 22 May 2011 at 12:25