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

Disable proto2 #11

Open
fdymylja opened this issue Jul 21, 2021 · 7 comments
Open

Disable proto2 #11

fdymylja opened this issue Jul 21, 2021 · 7 comments

Comments

@fdymylja
Copy link
Contributor

Based on the discussion, since protov3 does not support extensions, which makes protoreflect fast paths implementation a lot more easier, we shoudl either disable proto2 support or fallback to the original codegen (and maybe output a warning?)

@aaronc
Copy link
Member

aaronc commented Jul 21, 2021

How would the fallback look like?

@fdymylja
Copy link
Contributor Author

How would the fallback look like?

Most likely I'd fall back to this function from protoc-gen-go -> https://github.com/protocolbuffers/protobuf-go/blob/v1.27.1/cmd/protoc-gen-go/internal_gengo/main.go#L68

@aaronc
Copy link
Member

aaronc commented Jul 21, 2021

Basically anytime a message declares extensions ... to ... it would fallback? I also think it's fine to just fail.

@fdymylja
Copy link
Contributor Author

fdymylja commented Jul 21, 2021

Basically anytime a message declares extensions ... to ... it would fallback? I also think it's fine to just fail.

the fall back would be like -> if fileDescriptor.Syntax == "proto2" -> google-gen-go.GenerateFile.

Protobuf does not allow extensions unless you declare at top level this:

syntax="proto2";
...

Also for me failing is fine.

@aaronc
Copy link
Member

aaronc commented Jul 21, 2021

Maybe an error is better for now since it's unintended usage?

@aaronc
Copy link
Member

aaronc commented Jul 21, 2021

The only exception would be if we had to codegen for third-party files, but then you should just generate those separately

@fdymylja
Copy link
Contributor Author

Maybe an error is better for now since it's unintended usage?

for me its fine to throw an error and say we don't generate files defined with proto2 syntax

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

2 participants