File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "errors"
55 "fmt"
66 "regexp"
7+ "slices"
78 "strings"
89
910 "github.com/NETWAYS/check_prometheus/internal/alert"
@@ -23,17 +24,6 @@ type AlertConfig struct {
2324
2425var cliAlertConfig AlertConfig
2526
26- func contains (s string , list []string ) bool {
27- // Tiny helper to see if a string is in a list of strings
28- for _ , elem := range list {
29- if s == elem {
30- return true
31- }
32- }
33-
34- return false
35- }
36-
3727var alertCmd = & cobra.Command {
3828 Use : "alert" ,
3929 Short : "Checks the status of a Prometheus alert" ,
@@ -115,7 +105,7 @@ inactive = 0`,
115105
116106 // If it's not the Alert we're looking for, Skip!
117107 if cliAlertConfig .AlertName != nil {
118- if ! contains ( rl .AlertingRule .Name , cliAlertConfig . AlertName ) {
108+ if ! slices . Contains ( cliAlertConfig . AlertName , rl .AlertingRule .Name ) {
119109 continue
120110 }
121111 }
You can’t perform that action at this time.
0 commit comments