| 1 |
package sample |
| 2 |
|
| 3 |
import "runtime" |
| 4 |
|
| 5 |
// Where uses runtime.Caller, so the instrumentor must NOT emit its leading |
| 6 |
// //line directive: a static //line path would override the path runtime.Caller |
| 7 |
// reports at runtime (golang/go#26207). The file is still instrumented (Notify |
| 8 |
// calls inserted); it just carries no //line, so expected.golden has none. This |
| 9 |
// matches the AST-rewriting backend's behavior for such files. |
| 10 |
func Where() string { |
| 11 |
_, file, _, _ := runtime.Caller(0) |
| 12 |
return file |
| 13 |
} |