Closed larstos closed 8 months ago
This is a conflict between the message and the field -- they have the same qualified name, which is not allowed. Try this instead:
message DemoResponse {
message Data{
string resource_id = 1;
}
Data data = 1;
}
(lower-case field name -- so "data" doesn't conflict with "Data")
Here's a little more info on the topic: https://buf.build/docs/reference/protobuf-files-and-packages And here's some content from a language spec with even more: https://protobuf.com/docs/language-spec#named-elements
In general, if protoparse does not accept source code, you should try it with protoc
to see if it's a bug in protoparse or a bug in your own code. I've done a lot to make sure that this package is basically the same as protoc
, so it's usually (🤞) going to be a bug in your proto source.
Thanks for the reply. I will check it out
Hey, we use the protoparse to transfer proto file into our data ast. But we meet a strange case:
When i compile this proto file, it throws exception as"symbol DemoResponse.Data already defined". My go sdk version is 1.20.12, lib version is v1.15.6.
Please check out if there is something goes wrong or what should i do to fix this case?
Thanks