Recover goroutinegoroutine 
try/catch 
recover

Recover的用法:

defer可以读取有名返回值

理论:如果不进行recover,便会导致整个程序挂掉,

Recover()recover()

总结:使用recover()捕捉panic异常的时候,则需要defer来读取一个匿名函数,

goroutine

output

error: runtime error: integer divide by zero
error: runtime error: integer divide by zero
10 / (10 % 3) = 10
10 / (10 % 4) = 5
error: runtime error: integer divide by zero
10 / (10 % 6) = 2
10 / (10 % 7) = 3
10 / (10 % 8) = 5
10 / (10 % 9) = 10
error: runtime error: integer divide by zero
ch len is: 10
999
999
10
5
999
2
3
5
10
999