-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
protoc-gen-go: generate allocating accessors for message fields #1192
Comments
\cc @neild who has been interested in adding a "MutableFoo" accessor method which does exactly this. |
Definitely seems like the |
I very much want to add this. The sticking point has been binary and linker input size concerns. The name |
Just to give some feedback on the naming bikeshed:
@nield Can you expand on this? |
More code means larger linker inputs, and potentially larger binaries. Linker input and binary sizes are a particular area of concern for us, especially in programs which contain large amounts of generated protobuf code. |
Is your feature request related to a problem? Please describe.
My problem is that when I have a message that contains another message in a field, I have to manually check if it's been set or not and potentially allocate it myself. This results in me writing very boilerplate code to provide such an accessor method.
Describe the solution you'd like
I would like protoc-gen-go to automatically generate these accessors. Something along the lines of
Describe alternatives you've considered
Additional context
GetAllocatedMessage2()
would be appreciated.The text was updated successfully, but these errors were encountered: