api to rpc use generic paradigm

This commit is contained in:
withchao
2023-02-09 14:33:35 +08:00
parent 41d62937ff
commit 00d64119fa
8 changed files with 1513 additions and 1413 deletions
+6 -2
View File
@@ -38,8 +38,12 @@ func GetSelfFuncName() string {
return cleanUpFuncName(runtime.FuncForPC(pc).Name())
}
func GetFuncName(skip int) string {
pc, _, _, _ := runtime.Caller(skip + 1)
func GetFuncName(skips ...int) string {
skip := 1
if len(skips) > 0 {
skip = skips[0] + 1
}
pc, _, _, _ := runtime.Caller(skip)
return cleanUpFuncName(runtime.FuncForPC(pc).Name())
}