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