2 ms·
In the playground you have there, the string `v` is implicitly initialized to the empty string, which is not equal to nil. I'm referring to a different conditio
by oconnor663 11y ago
In the playground you have there, the string `v` is implicitly initialized to the empty string, which is not equal to nil. I'm referring to a different condition, where two different values are explicitly set to nil. Check this out: https://play.golang.org/p/qMmg7yOAKO https://play.golang.org/p/qMmg7yOAKO
- infogulch 11y agoYes this is what trips many people up. One reason `(* T)(nil) != nil` is because a `(* T)(nil)` can still have pointer methods called on it, and it can still work fine (as long as the receiver is never dereferenced, of course): https://play.golang.org/p/rup5cqapEU https://play.golang.org/p/rup5cqapEU