runtime: document the behaviour of Caller and Callers when used in deferred functions #26275
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
Documentation
Issues describing a change to documentation.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, I've tried on b001ffb.
What operating system and processor architecture are you using (
go env
)?What did you do?
https://play.golang.org/p/Jz6y0GkqTNW
What did you expect to see?
Either
Or the documentation of
runtime.Caller
mentioning that deferred functions have line numbers that point to the line afterreturn
.What did you see instead?
And no mention of
defer
inruntime.Caller
orruntime.Callers
docs.I understand why it's that way, and I've even created a wonky workaround (on Russian SO, on Playground). But I think that it would be good to mention this behaviour and basic reasoning behind it in the functions' docs.
The text was updated successfully, but these errors were encountered: