MCPcopy Create free account
hub / github.com/akyoto/q / stack

Function stack

src/errors/stack.go:9–31  ·  view source on GitHub ↗

stack generates a stack trace.

()

Source from the content-addressed store, hash-verified

7
8// stack generates a stack trace.
9func stack() string {
10 var (
11 final []string
12 buffer = make([]byte, 4096)
13 n = runtime.Stack(buffer, false)
14 stack = string(buffer[:n])
15 lines = strings.Split(stack, "\n")
16 limit = min(len(lines), 16)
17 )
18
19 for i := 6; i < limit; i += 2 {
20 line := strings.TrimSpace(lines[i])
21 space := strings.LastIndex(line, " ")
22
23 if space != -1 {
24 line = line[:space]
25 }
26
27 final = append(final, line)
28 }
29
30 return strings.Join(final, "\n")
31}

Callers 2

NewAtFunction · 0.85
NewFunction · 0.85

Calls 2

StackMethod · 0.80
SplitMethod · 0.80

Tested by

no test coverage detected