On Monday, 2 March 2020 04:49:34 UTC, Yuan Ting wrote:
>
> I write a simple program likes below and it triggers a data race alarm 
> with -race flag. But no matter how I run, this program will not panic. I 
> know it is legal to receive messages from nil channels, but I don't quite 
> understand why this program does not panic in the presence of data races.
>

Because not all data races cause panics.

A data race is where the behaviour of the program is non-deterministic - it 
could do either A or B depending on the precise timing of other things 
going on - but it doesn't necessarily mean that a panic will happen.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0832fc7d-3856-4309-b08d-b237e12202b9%40googlegroups.com.

Reply via email to