style(tracker): clean up Alerts Push and Pop

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2025-06-20 14:49:07 +03:00
parent 4f2c73d0db
commit f47bee37b0

View File

@ -96,15 +96,17 @@ func (m *Alerts) AddAlert(a Alert) {
}
func (m *Alerts) Push(x any) {
if _, ok := x.(Alert); !ok {
panic("invalid type for Alerts.Push, expected Alert")
}
m.alerts = append(m.alerts, x.(Alert))
}
func (m *Alerts) Pop() any {
old := m.alerts
n := len(old)
x := old[n-1]
m.alerts = old[0 : n-1]
return x
n := len(m.alerts)
last := m.alerts[n-1]
m.alerts = m.alerts[:n-1]
return last
}
func (m Alerts) Len() int { return len(m.alerts) }