You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
runtime.CallersFrames must take the result of runtime.Callers. The slice you are constructing from the result of runtime.Caller is not an allowed input.
You should use runtime.FuncForPC with the pc result from runtime.Caller.
More generally, runtime.Caller is an old API which does not take into account inlining correctly. You should use runtime.Callers + runtime.CallersFrames whenever possible.
I'm going to close, as this isn't a bug. If you have concrete suggestions for improving the documentation, please reopen and include those suggestions (or send a CL).
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?darwin, amd64
go env
OutputWhat did you do?
run
go test
main_test.go
go.mod
go.sum
(error repeated if I clear go.mod, go.sum and re-init module)
What did you expect to see?
PASS
What did you see instead?
Test pass if I uncomment log in TestCaller (line 16
//t.Log(name)
)Test pass if I remove at := require.New(t) and use require.True(t, ...) instead.
The text was updated successfully, but these errors were encountered: