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