This is a created article in which the information may have evolved or changed.
About the use of the Go language//1. Channels can be cached or without//2. Without caching, either read or write will block//3. With cache, if the cache overflows, it will block//4.make (Chan int,1) and make (chan int) is not the same, the first channel write two data will be blocked, the second write will block//5. If the process is blocking, but the master has exited execution, the program deadlock is considered//6. If the program is in a blocking state other than the main thread (without a co-process), the program is considered to be deadlocked//7. Bottom line: There is only one co-process (which can be the master), in blocking, thinking that the program is in deadlock//8. A subroutine is a special case of a process that blocks until the subroutine executes and returns, and the process may not wait until execution is complete, and then the condition is met and then returned to execute the package mainimport ("FMT") Func Main () {//make (chan string,1) and make (Chan string) is not the same as//make (Chan string,1) in the channel buffer is 1//here if you write make (chan String) causes blocking, deadlock, because there is no cached channel, either read or write will block//two solutions, move the push data into written (using GO statement), or increase the cache,//cache does not reach the upper limit, there will be no deadlock situation chan1: = Make ( Chan string,1) func () {fmt. Printf ("push data to channel \ n" in the process); Chan1 <-"Go Bar"} () fmt. Printf ("Data read from channel:%v", <-Chan1)}