File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 8
8
"fmt"
9
9
"math"
10
10
"os"
11
- "path/filepath"
12
11
"reflect"
13
12
"regexp"
14
13
"runtime"
@@ -107,21 +106,21 @@ func CallerInfo() []string {
107
106
108
107
var pc uintptr
109
108
var ok bool
110
- var file string
109
+ var path string
111
110
var line int
112
111
var name string
113
112
114
113
callers := []string {}
115
114
for i := 0 ; ; i ++ {
116
- pc , file , line , ok = runtime .Caller (i )
115
+ pc , path , line , ok = runtime .Caller (i )
117
116
if ! ok {
118
117
// The breaks below failed to terminate the loop, and we ran off the
119
118
// end of the call stack.
120
119
break
121
120
}
122
121
123
122
// This is a huge edge case, but it will panic if this is the case, see #180
124
- if file == "<autogenerated>" {
123
+ if path == "<autogenerated>" {
125
124
break
126
125
}
127
126
@@ -140,12 +139,11 @@ func CallerInfo() []string {
140
139
break
141
140
}
142
141
143
- parts := strings .Split (file , "/" )
144
- file = parts [len (parts )- 1 ]
142
+ parts := strings .Split (path , "/" )
143
+ file : = parts [len (parts )- 1 ]
145
144
if len (parts ) > 1 {
146
145
dir := parts [len (parts )- 2 ]
147
146
if (dir != "assert" && dir != "mock" && dir != "require" ) || file == "mock_test.go" {
148
- path , _ := filepath .Abs (file )
149
147
callers = append (callers , fmt .Sprintf ("%s:%d" , path , line ))
150
148
}
151
149
}
You can’t perform that action at this time.
0 commit comments