Skip to content

Commit 01cbcae

Browse files
committed
Sort members by ID
1 parent fe2bbaf commit 01cbcae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/apis/deployment/v1alpha/member_status_list.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package v1alpha
2424

2525
import (
2626
"math/rand"
27+
"sort"
2728

2829
"github.com/pkg/errors"
2930
)
@@ -83,7 +84,9 @@ func (l *MemberStatusList) add(m MemberStatus) error {
8384
return maskAny(errors.Wrapf(AlreadyExistsError, "Member '%s' already exists", m.ID))
8485
}
8586
}
86-
*l = append(src, m)
87+
newList := append(src, m)
88+
sort.Slice(newList, func(i, j int) bool { return newList[i].ID < newList[j].ID })
89+
*l = newList
8790
return nil
8891
}
8992

0 commit comments

Comments
 (0)