File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 7373
7474const attributeKey = "key"
7575
76+ // byKey implement sort.Interface - https://pkg.go.dev/sort#Interface
7677type byKey [][]tAttr
7778
7879func (s byKey ) Len () int {
@@ -83,8 +84,16 @@ func (s byKey) Swap(i, j int) {
8384 s [i ], s [j ] = s [j ], s [i ]
8485}
8586
87+ // Less returns true if ith element is nil or it's string representation
88+ // is before jth element.
8689func (s byKey ) Less (i , j int ) bool {
87- return s [i ][0 ][attributeKey ].(string ) < s [j ][0 ][attributeKey ].(string )
90+ if s [i ][0 ][attributeKey ] == nil {
91+ return true
92+ } else if s [j ][0 ][attributeKey ] == nil {
93+ return false
94+ } else {
95+ return s [i ][0 ][attributeKey ].(string ) < s [j ][0 ][attributeKey ].(string )
96+ }
8897}
8998
9099func TestAddEventsRetry (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments