Is there a way to test for failure of a go channel send without actually attempting the send? The standard non-blocking send is like so:
msg := "hi"
select {
case messages <- msg:
fmt.Println("sent message", msg)
default:
fmt.Println("no message sent")
}
The problem is that I need to have "msg" ready to send in order to test the channel.
I would like to test to see if a send will fail in a way that does not require having "msg" ready for sending.