Re:Go Subtleties You May Not Know
by aatd86 on Wednesday October 22, 2025 @09:37AM
(#45668969)
But that information disappears when you assign to an interface variable/container that is nillable.
It requires an assertion to recover the info about the value inside the interface being not nil.
basically `if v.(nil){...}
creates two branches. In one we know v is not nil (outside the if block) and it can therefore be assigned to non nillable variables so to speak...
basically `if v.(nil){...}
creates two branches. In one we know v is not nil (outside the if block) and it can therefore be assigned to non nillable variables so to speak...