mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -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.
|
||||
sort.SliceStable(problems, func(i, j int) bool {
|
||||
if problems[i].Metric < problems[j].Metric {
|
||||
return true
|
||||
} else if problems[i].Metric > problems[j].Metric {
|
||||
return false
|
||||
}
|
||||
|
||||
if problems[i].Metric == problems[j].Metric {
|
||||
return problems[i].Text < problems[j].Text
|
||||
}
|
||||
return problems[i].Metric < problems[j].Metric
|
||||
})
|
||||
|
||||
return problems, nil
|
||||
|
|
Loading…
Reference in a new issue