mirror of
https://github.com/cuigh/swirl
synced 2025-02-07 05:17:37 +00:00
Sort labels
This commit is contained in:
parent
4cc96bf9dd
commit
a60d2d39c1
@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -57,6 +58,9 @@ func NewOptions(m map[string]string) Options {
|
||||
for k, v := range m {
|
||||
opts = append(opts, &Option{Name: k, Value: v})
|
||||
}
|
||||
sort.Slice(opts, func(i, j int) bool {
|
||||
return opts[i].Name < opts[j].Name
|
||||
})
|
||||
return opts
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user