(skip int)
| 119 | } |
| 120 | |
| 121 | func getStackString(skip int) string { |
| 122 | // Get up to 5 callers, skipping this one and the skip count. |
| 123 | pcs := make([]uintptr, 5) |
| 124 | got := runtime.Callers(skip+1, pcs) |
| 125 | frames := runtime.CallersFrames(pcs[:got]) |
| 126 | |
| 127 | callers := []string{} |
| 128 | for { |
| 129 | frame, more := frames.Next() |
| 130 | callers = append(callers, fmt.Sprintf("%s:%v", frame.File, frame.Line)) |
| 131 | if !more { |
| 132 | break |
| 133 | } |
| 134 | } |
| 135 | return strings.Join(callers, " -> ") |
| 136 | } |