File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,25 @@ func (e *Error) SetLink(errorLink string) {
118
118
// Return the character index of the first relevant stack frame, or -1 if none were found.
119
119
// Additionally it returns the base path of the tree in which the identified code resides.
120
120
func findRelevantStackFrame (stack string ) (int , string ) {
121
- if frame := strings .Index (stack , filepath .ToSlash (BasePath )); frame != - 1 {
122
- return frame , BasePath
121
+ // Find first item in SourcePath that isn't in RevelPath.
122
+ // If first item is in RevelPath, keep track of position, trim and check again.
123
+ partialStack := stack
124
+ sourcePath := filepath .ToSlash (SourcePath )
125
+ revelPath := filepath .ToSlash (RevelPath )
126
+ sumFrame := 0
127
+ for {
128
+ frame := strings .Index (partialStack , sourcePath )
129
+ revelFrame := strings .Index (partialStack , revelPath )
130
+
131
+ if frame == - 1 {
132
+ break
133
+ } else if frame != revelFrame {
134
+ return sumFrame + frame , SourcePath
135
+ } else {
136
+ // Need to at least trim off the first character so this frame isn't caught again.
137
+ partialStack = partialStack [frame + 1 :]
138
+ sumFrame += frame + 1
139
+ }
123
140
}
124
141
for _ , module := range Modules {
125
142
if frame := strings .Index (stack , filepath .ToSlash (module .Path )); frame != - 1 {
You can’t perform that action at this time.
0 commit comments