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

Fix creation of proto values containing oneof fields. #44

Merged
merged 1 commit into from
Jun 5, 2018

Conversation

TristonianJones
Copy link
Collaborator

#36 Fixes setting proto oneof fields during object construction.

In go, oneof fields have a wrapper struct which is generated that is not a proto.Message
instance; however, all wrappers for oneof fields only contain a single field definition. This
fix relies on this behavior to detect and set oneof fields properly in object construction
expressions like: v1.Expr{id: 1, literal_expr: v1.Literal{string_value: 'oneof-test'}}

Note, the above expression is not quite as easy to use as the proto textformat where the
type of literal_expr field would be deduced at runtime without the developer needing
to specify it.

@TristonianJones TristonianJones merged commit d5dcbfb into google:master Jun 5, 2018
@TristonianJones TristonianJones deleted the reflection-fixes branch June 5, 2018 17:58
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

Successfully merging this pull request may close these issues.

2 participants