-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Let's say I have a struct like the one below.
type st struct {
i *struct {
j int
}
}
Sometimes I forget to check if a field is nil. If I do a return statement that ends up dereferencing a nil pointer, like http://play.golang.org/p/WzyNpsiBam, I would expect the stack trace from the panic to be on the same line as the return statement. Instead, the stack trace indicates that the nil pointer dereference happened on the same line as the caller.
Interestingly, the same thing happens if I assign to a variable first.
http://play.golang.org/p/M3q3cSLgBk
If I enter another function before returning the variable, the stack trace is correct.
http://play.golang.org/p/eOZc34Uya7
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.