Closed NIC619 closed 5 years ago
eventnotifier was set to nil if there was no event notifier server. However it was an interface with its value being nil, not a nil interface. So the comparison n.eventnotifier != nil will always return true.
eventnotifier
nil
n.eventnotifier != nil
true
Compare n.eventnotifier against typed nil
n.eventnotifier
pic credit: maxpixel
Thanks a lot for discovering and solving this issue Add the reference to the discussion: https://groups.google.com/forum/#!topic/golang-nuts/wnH302gBa4I/discussion
What was wrong?
eventnotifier
was set tonil
if there was no event notifier server. However it was an interface with its value beingnil
, not anil
interface. So the comparisonn.eventnotifier != nil
will always returntrue
.How was it fixed?
Compare
n.eventnotifier
against typednil
Cute Animal Picture