testing: wrong line number from t.Log when using "log := t.Log" #14415
Labels
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Consider the following test program:
When run with
go test -v
, the output is:The line number is wrong - it should be 7, not 6.
The testing package internally uses
runtime.Caller(3)
to identify the user code calling thetesting.T
logging function. It appears that thelog := t.Log
line is implicitly creating a closure, i.e. adding to the depth of the call stack, resulting in an incorrect line number.The text was updated successfully, but these errors were encountered: