Sort labels

This commit is contained in:
cuigh 2018-04-04 19:18:37 +08:00
parent 4cc96bf9dd
commit a60d2d39c1

View File

@ -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
} }