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?
to your account
Using go 1.7.3 on linux/amd64.
I tried to use binary.Write on a net.UDPAddr.Port, nothing was buffered. This took a while to debug.
I would have expected the binary.Write to either do the right thing (buffer two octets of data) or generate an error (either at compile time or at runtime).
The text was updated successfully, but these errors were encountered:
It did return an error. You didn't check it. https://play.golang.org/p/owZlw_-2LP
Sorry, something went wrong.
bytes.Buffer's documentation is irrelevant. You're not even making it that far. You're passing in something bogus to binary.Write and that is what is returning an error.
If something returns an error, check the error. That is the rule in Go.
A panic is not appropriate in this case.
No branches or pull requests