Here’s one: The fact that contexts are used extensively in the standard library but that there’s still no way to cancel a write to an io.Writer. The only way to “cancel” a write on a TCP socket is to set the socket’s “deadline” to some time in the past from another goroutine.
ainar-g|3 years ago
If you want a much more annoying example of inconsistency in the initial language design, look at the behaviour of nil and closed channels:
- sending data to a nil channel blocks forever;
- receiving data from a nil channel blocks forever;
- sending data to a closed channel causes a panic;
- receiving data from a closed channel is fine: you receive the zero value, forever.
I can understand the logic behind the last two (sending to a closed channel is an error in program logic, and closing a channel is a common idiom for broadcasting completion of a task to several goroutines), but the first two are just a massive footgun, and, in my opinion, should cause panics instead.
silisili|3 years ago