Beispiel #1
0
func funcWithDefer() (resultError error) {
	ch := make(chan bool, 1)
	defer channel.JudgeSendToClosedChannel(func(err error) {
		resultError = err
	})
	ch <- true
	return
}
Beispiel #2
0
func funcToTest() (resultError error) {
	ch := make(chan bool)
	close(ch)
	defer channel.JudgeSendToClosedChannel(func(err error) {
		resultError = err
	})
	ch <- true
	return
}
Beispiel #3
0
func funcWithDeferNop() (resultError error) {
	ch := make(chan bool, 1)
	defer channel.JudgeSendToClosedChannel(channel.OMIT_SEND_TO_CLOSED_CHANNEL_ERROR())
	ch <- true
	return
}
Beispiel #4
0
func TestJudgeSendToClosedChannel(t *testing.T) {
	defer channel.JudgeSendToClosedChannel(channel.OMIT_SEND_TO_CLOSED_CHANNEL_ERROR())
	err := funcToTest()
	t.Log(err)
}