errorLocationValue provides the function name and line number for where this function was called from - 1 line. What this means is that the returned value will be homed to the file line directly above where this function was called. This is a utility for testing error details and that associated err
(c *gc.C)
| 21 | // This is a utility for testing error details and that associated error calls |
| 22 | // set the error location correctly. |
| 23 | func errorLocationValue(c *gc.C) string { |
| 24 | rpc := make([]uintptr, 1) |
| 25 | n := runtime.Callers(2, rpc[:]) |
| 26 | if n < 1 { |
| 27 | return "" |
| 28 | } |
| 29 | frame, _ := runtime.CallersFrames(rpc).Next() |
| 30 | return fmt.Sprintf("%s:%d", frame.Function, frame.Line-1) |
| 31 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…