File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package types
18
18
19
19
import (
20
20
"fmt"
21
+ "sort"
21
22
"strconv"
22
23
"strings"
23
24
"time"
@@ -54,13 +55,19 @@ type LogPatternFlag struct {
54
55
}
55
56
56
57
// String implements the String function for flag.Value interface
58
+ // Returns a space separated sorted by keys string of map values.
57
59
func (lpf * LogPatternFlag ) String () string {
58
60
result := ""
59
- for k , v := range lpf .logPatternCountMap {
61
+ var keys []string
62
+ for k := range lpf .logPatternCountMap {
63
+ keys = append (keys , k )
64
+ }
65
+ sort .Strings (keys )
66
+ for _ , k := range keys {
60
67
if result != "" {
61
68
result += " "
62
69
}
63
- result += fmt .Sprintf ("%v:%v" , k , v )
70
+ result += fmt .Sprintf ("%v:%v" , k , lpf . logPatternCountMap [ k ] )
64
71
}
65
72
return result
66
73
}
You can’t perform that action at this time.
0 commit comments