From cddf1d93735052590755460f4b3c8264e0d57399 Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期一, 07 八月 2023 09:39:20 +0800 Subject: [PATCH] fix --- pkg/safe/safe.go | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/pkg/safe/safe.go b/pkg/safe/safe.go index 2e37644..95855cf 100644 --- a/pkg/safe/safe.go +++ b/pkg/safe/safe.go @@ -1,20 +1,20 @@ -package safe - -import ( - "aps_admin/pkg/logx" - "runtime/debug" -) - -func Go(fn func()) { - go func() { - defer RecoverPanic() - fn() - }() -} - -func RecoverPanic() { - if r := recover(); r != nil { - logx.Errorf("panic: %v, stack trace: %v", r, string(debug.Stack())) - return - } -} +package safe + +import ( + "aps_admin/pkg/logx" + "runtime/debug" +) + +func Go(fn func()) { + go func() { + defer RecoverPanic() + fn() + }() +} + +func RecoverPanic() { + if r := recover(); r != nil { + logx.Errorf("panic: %v, stack trace: %v", r, string(debug.Stack())) + return + } +} -- Gitblit v1.8.0