@@ -36,20 +36,20 @@ type failureDomainAggregation struct {
3636type failureDomainAggregations []failureDomainAggregation
3737
3838const (
39- ASCENDING = iota
40- DESCENDING
39+ ascending = iota
40+ descending
4141)
4242
4343func (f failureDomainAggregations ) SortFunc (i , j failureDomainAggregation , order int ) int {
4444 // If a failure domain has less priority machines then the other, it goes first
4545 if i .countPriority < j .countPriority {
46- if order == ASCENDING {
46+ if order == ascending {
4747 return - 1
4848 }
4949 return 1
5050 }
5151 if i .countPriority > j .countPriority {
52- if order == ASCENDING {
52+ if order == ascending {
5353 return 1
5454 }
5555 return - 1
@@ -58,13 +58,13 @@ func (f failureDomainAggregations) SortFunc(i, j failureDomainAggregation, order
5858 // If a failure domain has the same number of priority machines then the other,
5959 // use the number of overall machines to pick which one goes first.
6060 if i .countAll < j .countAll {
61- if order == ASCENDING {
61+ if order == ascending {
6262 return - 1
6363 }
6464 return 1
6565 }
6666 if i .countAll > j .countAll {
67- if order == ASCENDING {
67+ if order == ascending {
6868 return 1
6969 }
7070 return - 1
@@ -73,7 +73,7 @@ func (f failureDomainAggregations) SortFunc(i, j failureDomainAggregation, order
7373 // If both failure domain have the same number of priority machines and overall machines, we keep the order
7474 // in the list which ensure a certain degree of randomness because the list originates from a map.
7575 // This helps to spread machines e.g. when concurrently working on many clusters.
76- if order == ASCENDING {
76+ if order == ascending {
7777 return 1
7878 }
7979 return - 1
@@ -86,7 +86,7 @@ func PickMost(ctx context.Context, failureDomains []clusterv1.FailureDomain, all
8686 return ""
8787 }
8888 slices .SortFunc (aggregations , func (i , j failureDomainAggregation ) int {
89- return aggregations .SortFunc (i , j , DESCENDING )
89+ return aggregations .SortFunc (i , j , descending )
9090 })
9191 if len (aggregations ) > 0 && aggregations [0 ].countPriority > 0 {
9292 return aggregations [0 ].id
@@ -108,7 +108,7 @@ func PickFewest(ctx context.Context, failureDomains []clusterv1.FailureDomain, a
108108 return ""
109109 }
110110 slices .SortFunc (aggregations , func (i , j failureDomainAggregation ) int {
111- return aggregations .SortFunc (i , j , ASCENDING )
111+ return aggregations .SortFunc (i , j , ascending )
112112 })
113113 return aggregations [0 ].id
114114}
0 commit comments