fix golint issues, exported doc (#451)

This commit is contained in:
Kevin Wan
2021-02-08 21:31:56 +08:00
committed by GitHub
parent 9b0625bb83
commit 54414db91d
8 changed files with 31 additions and 11 deletions

View File

@@ -8,11 +8,12 @@ import (
"github.com/tal-tech/go-zero/core/rescue"
)
// GoSafe runs the given fn using another goroutine, recovers if fn panics.
func GoSafe(fn func()) {
go RunSafe(fn)
}
// Only for debug, never use it in production
// RoutineId is only for debug, never use it in production.
func RoutineId() uint64 {
b := make([]byte, 64)
b = b[:runtime.Stack(b, false)]
@@ -24,6 +25,7 @@ func RoutineId() uint64 {
return n
}
// RunSafe runs the given fn, recovers if fn panics.
func RunSafe(fn func()) {
defer rescue.Recover()