File: resolver.go

package info (click to toggle)
golang-github-franela-goblin 0.0.1%2Bgit20160123.62.889391d-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 176 kB
  • sloc: makefile: 7
file content (21 lines) | stat: -rw-r--r-- 431 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
}