Is my understanding roughly right below?
go
can mostly detect dead lock
at compile-time.
That go
can use chan
to minimize race condition
is because only single sender or receiver goroutine
can have access to any specific chan
at a time.
No, the first is completely wrong and the second is at least stated unclear or strange.
I wouldn't say that's accurate. On the first point there aren't any compile time guarantees about dead locking, if you use a mutex poorly you will be dead locking, no compiler can prevent that. You can test for race conditions easily, but that's different.
On the second point, the channel serializes your asynchronous operations but I don't think how you state it makes much sense. A bunch of goroutines can be writing to and reading from it. It's just like a queue to put the data in, no coordination is guaranteed. You won't panic due to multiple routines reading off it or writing to it at the same time but if you have that happening Go isn't doing anything to make your program work well, you have to coordinate the routines yourself using channels.
According to this tutorial, it can catch some deadlocks. I've not gone though this tutorial though...
http://guzalexander.com/2013/12/06/golang-channels-tutorial.htmlenter link description here