mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
util/promlint: simplify sorting function (#6448)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
parent
4df814f509
commit
b15dda9e07
|
@ -85,13 +85,10 @@ func (l *Linter) Lint() ([]Problem, error) {
|
||||||
|
|
||||||
// Ensure deterministic output.
|
// Ensure deterministic output.
|
||||||
sort.SliceStable(problems, func(i, j int) bool {
|
sort.SliceStable(problems, func(i, j int) bool {
|
||||||
if problems[i].Metric < problems[j].Metric {
|
if problems[i].Metric == problems[j].Metric {
|
||||||
return true
|
|
||||||
} else if problems[i].Metric > problems[j].Metric {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return problems[i].Text < problems[j].Text
|
return problems[i].Text < problems[j].Text
|
||||||
|
}
|
||||||
|
return problems[i].Metric < problems[j].Metric
|
||||||
})
|
})
|
||||||
|
|
||||||
return problems, nil
|
return problems, nil
|
||||||
|
|
Loading…
Reference in a new issue