Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
LC_soapi
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
26198d5b
authored
Jan 07, 2020
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
caller函数修改
parent
1dadd8a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
pkg/util/caller.go
pkg/util/caller.go
View file @
26198d5b
...
...
@@ -3,20 +3,22 @@ package util
import
"runtime"
type
Caller
struct
{
FileName
string
FileLine
int
FileName
string
FileLine
int
FunctionName
string
}
//获取上级调用者
//2代表上级,3代表上上级
func
getCaller
(
)
Caller
{
pc
,
_
,
_
,
_
:=
runtime
.
Caller
(
2
)
func
GetCaller
(
skip
int
)
Caller
{
pc
,
_
,
_
,
_
:=
runtime
.
Caller
(
skip
)
caller
:=
runtime
.
FuncForPC
(
pc
)
_
,
fileLine
:=
caller
.
FileLine
(
pc
)
n
ame
:=
caller
.
Name
()
fileName
,
fileLine
:=
caller
.
FileLine
(
pc
)
functionN
ame
:=
caller
.
Name
()
return
Caller
{
FileName
:
name
,
FileLine
:
fileLine
,
FunctionName
:
functionName
,
FileName
:
fileName
,
FileLine
:
fileLine
,
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment