MCPcopy Create free account
hub / github.com/imroc/req / printStack

Function printStack

internal/bisect/bisect.go:505–529  ·  view source on GitHub ↗

printStack prints to w a multi-line report containing a formatting of the call stack stk, with each line preceded by the marker for h.

(w Writer, h uint64, stk []uintptr)

Source from the content-addressed store, hash-verified

503// printStack prints to w a multi-line report containing a formatting of the call stack stk,
504// with each line preceded by the marker for h.
505func printStack(w Writer, h uint64, stk []uintptr) error {
506 buf := make([]byte, 0, 2048)
507
508 var prefixBuf [100]byte
509 prefix := AppendMarker(prefixBuf[:0], h)
510
511 frames := runtime.CallersFrames(stk)
512 for {
513 f, more := frames.Next()
514 buf = append(buf, prefix...)
515 buf = append(buf, f.Func.Name()...)
516 buf = append(buf, "()\n"...)
517 buf = append(buf, prefix...)
518 buf = append(buf, '\t')
519 buf = appendFileLine(buf, f.File, f.Line)
520 buf = append(buf, '\n')
521 if !more {
522 break
523 }
524 }
525 buf = append(buf, prefix...)
526 buf = append(buf, '\n')
527 _, err := w.Write(buf)
528 return err
529}
530
531// Marker returns the match marker text to use on any line reporting details
532// about a match of the given ID.

Callers 1

stackMethod · 0.85

Calls 4

AppendMarkerFunction · 0.85
appendFileLineFunction · 0.85
NameMethod · 0.80
WriteMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…