-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: invalid memory address or nil pointer dereference when body is a *Buffer nil #44327
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
Comments
I don't think there's anything to be done here. A nil *bytes.Buffer and untyped nil are not the same and the example you provide that panics seems to indicate a clear error in your user code, not in net/http. |
Maybe I was wrong about my understanding. But I think a function that provides a pointer as a parameter should handle the case that this pointer should be null. |
This is https://golang.org/doc/faq#nil_error. The fix is to not pass a nil |
See also #22729. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Code to reproduce it
What did you expect to see?
I want to have the same behaviour when I run this code
package main
What did you see instead?
The text was updated successfully, but these errors were encountered: