Skip to content

Commit 0365be5

Browse files
committed
save
1 parent 1ce3763 commit 0365be5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

promlinter.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"go/ast"
66
"go/token"
7+
"log"
78
"sort"
89
"strconv"
910
"strings"
@@ -149,7 +150,7 @@ func RunLint(fs *token.FileSet, files []*ast.File, s Setting) []Issue {
149150
}
150151

151152
// lint metrics
152-
for idx, mfp := range v.metrics {
153+
for _, mfp := range v.metrics {
153154
problems, err := promlint.NewWithMetricFamilies([]*dto.MetricFamily{mfp.MetricFamily}).Lint()
154155
if err != nil {
155156
panic(err)
@@ -174,6 +175,10 @@ func RunLint(fs *token.FileSet, files []*ast.File, s Setting) []Issue {
174175
}
175176
}
176177

178+
for _, iss := range v.issues {
179+
log.Printf("%s, pos: %s", iss.Metric, iss.Pos)
180+
}
181+
177182
sort.Slice(v.issues, func(i, j int) bool {
178183
return v.issues[i].Pos.String() < v.issues[j].Pos.String()
179184
})

promlinter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestRun(t *testing.T) {
2323
}
2424

2525
for idx, iss := range issues {
26-
t.Logf("%d: %q", idx, iss)
26+
t.Logf("%d: %q: %s", idx, iss.Metric, iss.Pos)
2727

2828
switch iss.Metric {
2929
case "kube_daemonset_labels", "test_metric_name", "foo":

0 commit comments

Comments
 (0)