-
Notifications
You must be signed in to change notification settings - Fork 18k
encoding/binary: panic when Write a nil. #60814
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
The struct pointed to by the data pointer may be acceptable by |
Change https://go.dev/cl/503695 mentions this issue: |
The documentation at https://pkg.go.dev/encoding/binary#Write says:
The nil interface value is not any of those things, so this is a user error that should have been caught during testing and/or code review; a panic is appropriate in that case. |
The nil interface value is not a pointer. |
The standard library does not do explicit checks for all possible incorrect values. Panicking on an invalid value is acceptable behavior. |
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?
then:
What did you expect to see?
nothing will be write to
bytes.NewBuffer(nil)
What did you see instead?
The text was updated successfully, but these errors were encountered: