From 8a3ec78ae8c0b5d4bec965c539761d96090afe71 Mon Sep 17 00:00:00 2001 From: Sahil Rasaikar Date: Wed, 8 Oct 2025 22:56:35 +0530 Subject: [PATCH] fix: reorder AlertState constants to start with StateUnknown, reorder String method to match constant order. Signed-off-by: Sahil Rasaikar --- rules/alerting.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rules/alerting.go b/rules/alerting.go index 74f199e9f0..b0151d7cb3 100644 --- a/rules/alerting.go +++ b/rules/alerting.go @@ -51,9 +51,9 @@ type AlertState int const ( // StateUnknown is the state of an alert that has not yet been evaluated. - StateUnknown AlertState = -1 + StateUnknown AlertState = iota // StateInactive is the state of an alert that is neither firing nor pending. - StateInactive AlertState = iota + StateInactive // StatePending is the state of an alert that has been active for less than // the configured threshold duration. StatePending @@ -64,14 +64,14 @@ const ( func (s AlertState) String() string { switch s { + case StateUnknown: + return "unknown" case StateInactive: return "inactive" case StatePending: return "pending" case StateFiring: return "firing" - case StateUnknown: - return "unknown" } panic(fmt.Errorf("unknown alert state: %d", s)) }