cli/format: Use Matchers.String for extended formatting

Signed-off-by: Kiril Vladimirov <kiril@vladimiroff.org>
This commit is contained in:
Kiril Vladimirov 2021-02-18 23:41:57 +02:00
parent 217562e838
commit 84dd6ab8d7

View File

@ -22,6 +22,7 @@ import (
"text/tabwriter" "text/tabwriter"
"github.com/prometheus/alertmanager/api/v2/models" "github.com/prometheus/alertmanager/api/v2/models"
"github.com/prometheus/alertmanager/pkg/labels"
) )
type ExtendedFormatter struct { type ExtendedFormatter struct {
@ -130,9 +131,9 @@ func extendedFormatAnnotations(labels models.LabelSet) string {
} }
func extendedFormatMatchers(matchers models.Matchers) string { func extendedFormatMatchers(matchers models.Matchers) string {
output := []string{} lms := labels.Matchers{}
for _, matcher := range matchers { for _, matcher := range matchers {
output = append(output, simpleFormatMatcher(*matcher)) lms = append(lms, labelsMatcher(*matcher))
} }
return strings.Join(output, " ") return lms.String()
} }