Go in-depth study of select

select usage

1) select only be used for channel operation (writing, reading), and the switch number is more common

2) select a random case, the switch case is in the order of execution

3) select should be taken to avoid deadlock, but can also achieve their own timeout mechanism.

4) select switch where there are no similar usage of fallthough

5) select function can not be connected to the same switch or other expressions like.









Learning (Reproduced) Source: Go Language Chinese network

Guess you like

Origin www.cnblogs.com/akmfwei/p/12632574.html