试了这个,没作用
defer func() {
r := recover()
if r == nil {
return
}
// stack (copied from net/http/server.go:1284)
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, true)]
ioutil.WriteFile("err.txt", buf, 0644)
os.Exit(1)
}()
有疑问加站长微信联系(非本文作者)