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 query.go to avoid invalid protobuf assumptions #967

Merged
merged 1 commit into from
Jul 8, 2019
Merged

Fix query.go to avoid invalid protobuf assumptions #967

merged 1 commit into from
Jul 8, 2019

Conversation

dsnet
Copy link
Contributor

@dsnet dsnet commented Jul 8, 2019

The golang/protobuf compatibility agreement reserves the right add/remove
XXX fields and methods.

Fix this code to avoid assuming:

  • that XXX_WellKnownType always exists (it won't in the future).
    Instead, it should determine whether a message is a well-known type
    based on its full name.
  • that Go struct field indexes are stable (they aren't).
    An internal field may be added to the front of the message,
    causing the current assumptions to be invalidated.
    Instead, access the struct field by name, which will not change.

The golang/protobuf compatibility agreement reserves the right add/remove
XXX fields and methods.

Fix this code to avoid assuming:
* that XXX_WellKnownType always exists (it won't in the future).
Instead, it should determine whether a message is a well-known type
based on its full name.
* that Go struct field indexes are stable (they aren't).
An internal field may be added to the front of the message,
causing the current assumptions to be invalidated.
Instead, access the struct field by name, which will not change.
Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Joe, thanks for this, looks great.

@johanbrandhorst
Copy link
Collaborator

I've triggered a rerun of the flaky test.

@johanbrandhorst johanbrandhorst merged commit e911301 into grpc-ecosystem:master Jul 8, 2019
@johanbrandhorst
Copy link
Collaborator

Thanks for your contribution! When will these changes be breaking? I.e. what version of golang/protobuf will require this commit to work?

@dsnet
Copy link
Contributor Author

dsnet commented Jul 8, 2019

When will these changes be breaking?

When google.golang.org/protobuf is released, we will also tag a github.com/golang/[email protected] that depends on the new implementation. We're targeting a release at the end of July, but it's likely that the date will slip, unfortunately.

what version of golang/protobuf will require this commit to work?

Thus, anything that depends on the new implementation or v1.4.0+ will be broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants