Tag: recover

Golang recover捕获panic异常

Jackey Golang 3,081 次浏览 , ,
[codesyntax lang="c"] package main import ( "fmt" ) func test() int { defer func() { err := recover() if err != nil { fmt.Println(err) } }() var a int = 10 var b int = 0 return a/b } ...
Go