(fn any)
| 118 | } |
| 119 | |
| 120 | func functionName(fn any) (string, error) { |
| 121 | if fnName, isString := fn.(string); isString { |
| 122 | return fnName, nil |
| 123 | } |
| 124 | |
| 125 | if fnName, isFunc := functionNameForPC(reflect.ValueOf(fn).Pointer()); isFunc { |
| 126 | return fnName, nil |
| 127 | } |
| 128 | |
| 129 | return "", errors.New(fmt.Sprintf("Invalid function %#v", fn)) |
| 130 | } |
| 131 | |
| 132 | func functionNameForPC(pc uintptr) (string, bool) { |
| 133 | fn := runtime.FuncForPC(pc) |
no test coverage detected