0
0
mirror of https://github.com/thegeeklab/wp-opentofu.git synced 2024-11-24 23:30:39 +00:00
wp-opentofu/vendor/github.com/franela/goblin/resolver.go

22 lines
431 B
Go
Raw Normal View History

2017-05-30 14:47:23 +00:00
package goblin
import (
"runtime/debug"
"strings"
)
func ResolveStack(skip int) []string {
return cleanStack(debug.Stack(), skip)
}
func cleanStack(stack []byte, skip int) []string {
arrayStack := strings.Split(string(stack), "\n")
var finalStack []string
for i := skip; i < len(arrayStack); i++ {
if strings.Contains(arrayStack[i], ".go") {
finalStack = append(finalStack, arrayStack[i])
}
}
return finalStack
}