So Heartbeat.Err() could only return something not nil when called on the copy within Heartbeat.controller() (there is no such call). If any external caller would call it (or Heartbeat.Close() which in turn returns Heartbeat.Err()), the return value would always be nil.
Given that neither seems to be called somewhere else in the code base, this won't cause any problems right now, but still looks broken.
Most receiver functions for
Heartbeat
operate on a copy instead of a pointer.Even though
Heartbeat.setError()
operates on a pointer: https://github.com/Icinga/icingadb/blob/cf3a13d3f50214efa90e3676076240cf15e6dea0/pkg/icingaredis/heartbeat.go#L149-L153It is only called from within
Heartbeat.controller()
which itself operates on a copy: https://github.com/Icinga/icingadb/blob/cf3a13d3f50214efa90e3676076240cf15e6dea0/pkg/icingaredis/heartbeat.go#L79So
Heartbeat.Err()
could only return something notnil
when called on the copy withinHeartbeat.controller()
(there is no such call). If any external caller would call it (orHeartbeat.Close()
which in turn returnsHeartbeat.Err()
), the return value would always benil
.Given that neither seems to be called somewhere else in the code base, this won't cause any problems right now, but still looks broken.