From fb8479a677f36ed8f23b5d7432c42b8106a48194 Mon Sep 17 00:00:00 2001 From: AixesHunter <44970652+aixeshunter@users.noreply.github.com> Date: Wed, 19 Dec 2018 09:44:03 +0000 Subject: [PATCH] Variable 'labels' collides with imported package name (#5012) Signed-off-by: aixeshunter --- rules/alerting.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rules/alerting.go b/rules/alerting.go index 8a16001f8..e7cec6666 100644 --- a/rules/alerting.go +++ b/rules/alerting.go @@ -495,22 +495,22 @@ func (r *AlertingRule) HTMLSnippet(pathPrefix string) html_template.HTML { alertNameLabel: model.LabelValue(r.name), } - labels := make(map[string]string, len(r.labels)) + labelsMap := make(map[string]string, len(r.labels)) for _, l := range r.labels { - labels[l.Name] = html_template.HTMLEscapeString(l.Value) + labelsMap[l.Name] = html_template.HTMLEscapeString(l.Value) } - annotations := make(map[string]string, len(r.annotations)) + annotationsMap := make(map[string]string, len(r.annotations)) for _, l := range r.annotations { - annotations[l.Name] = html_template.HTMLEscapeString(l.Value) + annotationsMap[l.Name] = html_template.HTMLEscapeString(l.Value) } ar := rulefmt.Rule{ Alert: fmt.Sprintf("%s", pathPrefix+strutil.TableLinkForExpression(alertMetric.String()), r.name), Expr: fmt.Sprintf("%s", pathPrefix+strutil.TableLinkForExpression(r.vector.String()), html_template.HTMLEscapeString(r.vector.String())), For: model.Duration(r.holdDuration), - Labels: labels, - Annotations: annotations, + Labels: labelsMap, + Annotations: annotationsMap, } byt, err := yaml.Marshal(ar)