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
Invalid condition in WithContext method. #498
Comments
This is a regression from this commit: 588a61c |
Perhaps we should remove the condition altogether. |
That's what I'd originally done in PR #499 but then changed it to add back a similar condition using |
Ok, I'll prefer removing the condition then. |
Done. #499 should be ready to go. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since non-pointer receivers are passed by value, once the receiver for
WithContext
was reverted to a non-pointer, this condition is guaranteed to always be false.In other words, the receiver (
l
) is a copy of the Logger struct from the caller and its address can never be the same as the logger attached to theContext
.Either the receiver should be converted back to a pointer (and different fixes devised for #116 and #400) -- or, this condition should simply be removed and the docs updated to say that the Context will always be replaced no matter what (because that's the actual behavior with the current logic).
[Here's a Go Playground link proving that non-pointer receivers have different addresses from those of their caller]
The text was updated successfully, but these errors were encountered: