Skip to content

Commit 516df73

Browse files
committed
resolved lint errors
This commit resolves lint errors caused during previous commit.
1 parent 499f7ba commit 516df73

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

internal/contract/version.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,8 @@ func GetGKMetadata(ctx context.Context, c client.Reader, gk schema.GroupKind) (*
192192
// versions. e.g. v2, v1, v1beta2, v1beta1, v1alpha1.
193193
type kubeAwareAPIVersions []string
194194

195-
// SortFunc uses these constants to determine the order of sorting
196195
const (
197-
// Used to sort in ascending order of occurance
198196
ascending = iota
199-
200-
// Used to sort in descending order of occurance
201197
descending
202198
)
203199

internal/controllers/machinedeployment/mdutil/util.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ import (
4242
"sigs.k8s.io/cluster-api/util/conversion"
4343
)
4444

45-
// Sort functions in this file, use these constants to determine the sorting order
45+
// Sort functions in this file, use these constants to determine the sorting order.
4646
const (
47-
// Used to sort elements in Ascending order
48-
// Also used in cases, where the order is from older to newer occurances
47+
// Used to sort elements in Ascending order.
48+
// Also used in cases, where the order is from older to newer occurrences.
4949
ASCENDING = iota
5050

51-
// Used to sort elements in Descending order
52-
// Also used in cases, where the order is from newer to older occurances
51+
// Used to sort elements in Descending order.
52+
// Also used in cases, where the order is from newer to older occurrences.
5353
DESCENDING
5454
)
5555

util/failuredomains/failure_domains.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ type failureDomainAggregation struct {
3636
type failureDomainAggregations []failureDomainAggregation
3737

3838
const (
39-
ASCENDING = iota
40-
DESCENDING
39+
ascending = iota
40+
descending
4141
)
4242

4343
func (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
}

util/failuredomains/failure_domains_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ func TestFailureDomainAggregationsSort(t *testing.T) {
871871
}
872872

873873
slices.SortFunc(aggregations, func(i, j failureDomainAggregation) int {
874-
return aggregations.SortFunc(i, j, ASCENDING)
874+
return aggregations.SortFunc(i, j, ascending)
875875
})
876876

877877
// the result should be sorted so the fd with less priority machines are first,

0 commit comments

Comments
 (0)