-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
status: avoid allocations when returning an OK status #2929
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind also updating FromContextError
as well? Thanks!
@dfawley good point, looks like the implementations on nil Status do what we want. PTAL? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
https://travis-ci.org/grpc/grpc-go/jobs/563180848 seems like an infra flake? not sure how to tell travis to retry it |
Yes, looks like it. I kicked travis. |
Isn't this a breaking change for the API? Clients that expect a non-nil OK status is currently getting nil now and can cause issues with server and clients on different versions |
Why is code broken whether the returned status is |
I'm just the messenger here :) While I agree that nil and ok are equivalent in this context, this is still a breaking change. I'm guessing the nil check was for panics because it's not too common to call methods on a nil struct the way it's handled in go-grpc for the status type. |
Calls to methods on a Did the behavior change? Yes, but the same is true for bug fixes. Was this absolutely necessary? No, we could have done something similar differently, but I don't think it's reasonable or correct for applications to be checking for |
It's not expected for
FromError
to allocate when you have no error