Is there an existing issue for this?
Current Behavior
|
// Retrieve our struct and type-assert it |
|
val := session.Values["person"] |
|
var person = &Person{} |
|
if person, ok := val.(*Person); !ok { |
|
// Handle the case that it's not an expected type |
|
} |
In this example val.(*Person) will not be assigned to person as it is outside of the if statement scope.
Suggested Correction
// Retrieve our struct and type-assert it
val := session.Values["person"]
person, ok := val.(*Person)
if !ok {
// Handle the case that it's not an expected type
}