Skip to content

Commit 631a323

Browse files
jimmidysondkoshkin
andauthored
build: Update all tools (#1237)
**What problem does this PR solve?**: **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. --> --------- Co-authored-by: Dimitri Koshkin <[email protected]>
1 parent f02f247 commit 631a323

File tree

11 files changed

+446
-441
lines changed

11 files changed

+446
-441
lines changed

api/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/ap
55

66
go 1.23.0
77

8-
toolchain go1.24.4
8+
toolchain go1.24.5
99

1010
replace github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common => ../common
1111

common/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/co
55

66
go 1.23.0
77

8-
toolchain go1.24.4
8+
toolchain go1.24.5
99

1010
require (
1111
github.com/evanphx/json-patch/v5 v5.9.11

common/pkg/capi/utils/utils.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ func ManagementOrFutureManagementCluster(ctx context.Context, c client.Reader) (
6464
return cluster, nil
6565
}
6666

67-
func clusterAnnotationsFromNodes(ctx context.Context, c client.Reader) (string, string, error) {
67+
func clusterAnnotationsFromNodes(
68+
ctx context.Context,
69+
c client.Reader,
70+
) (clusterName, clusterNamespace string, err error) {
6871
allNodes := &corev1.NodeList{}
69-
err := c.List(ctx, allNodes)
70-
if err != nil {
72+
if err := c.List(ctx, allNodes); err != nil {
7173
return "", "", fmt.Errorf("error listing Nodes: %w", err)
7274
}
7375

common/pkg/capi/utils/utils_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func TestManagementOrFutureManagementCluster(t *testing.T) {
138138
},
139139
},
140140
wantErr: fmt.Errorf(
141-
"error determining management cluster for the provided client: error getting Cluster object based on Node annotations: clusters.cluster.x-k8s.io \"management-cluster\" not found",
141+
`error determining management cluster for the provided client: error getting Cluster object based on Node annotations: clusters.cluster.x-k8s.io "management-cluster" not found`, //nolint:lll // Long error message.
142142
),
143143
},
144144
{
@@ -162,7 +162,7 @@ func TestManagementOrFutureManagementCluster(t *testing.T) {
162162
},
163163
},
164164
wantErr: fmt.Errorf(
165-
"error determining management cluster for the provided client: missing \"cluster.x-k8s.io/cluster-name\" annotation",
165+
`error determining management cluster for the provided client: missing "cluster.x-k8s.io/cluster-name" annotation`, //nolint:lll // Long error message.
166166
),
167167
},
168168
{
@@ -186,7 +186,7 @@ func TestManagementOrFutureManagementCluster(t *testing.T) {
186186
},
187187
},
188188
wantErr: fmt.Errorf(
189-
"error determining management cluster for the provided client: missing \"cluster.x-k8s.io/cluster-namespace\" annotation",
189+
`error determining management cluster for the provided client: missing "cluster.x-k8s.io/cluster-namespace" annotation`, //nolint:lll // Long error message.
190190
),
191191
},
192192
{
@@ -213,7 +213,7 @@ func TestManagementOrFutureManagementCluster(t *testing.T) {
213213
},
214214
},
215215
wantErr: fmt.Errorf(
216-
"error determining management cluster for the provided client: multiple Cluster objects found, expected exactly one",
216+
"error determining management cluster for the provided client: multiple Cluster objects found, expected exactly one", //nolint:lll // Long error message.
217217
),
218218
},
219219
}
@@ -239,7 +239,7 @@ func TestManagementOrFutureManagementCluster(t *testing.T) {
239239

240240
func buildFakeClientForTest(t *testing.T, clusters []clusterv1.Cluster, nodes []corev1.Node) client.Client {
241241
t.Helper()
242-
var objs []client.Object
242+
objs := make([]client.Object, 0, len(clusters)+len(nodes))
243243
for i := range clusters {
244244
objs = append(objs, &clusters[i])
245245
}

common/pkg/testutils/capitest/variables.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func ValidateDiscoverVariables[V mutation.DiscoverVariables](
3434
handlerCreator func() V,
3535
variableTestDefs ...VariableTestDef,
3636
) {
37+
t.Helper()
38+
3739
ValidateDiscoverVariablesAs[V, any](
3840
t,
3941
variableName,

common/pkg/testutils/openapi/cel.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func validateCELRecursively(
7070
continue
7171
}
7272

73-
jsonName := jsonFieldName(fieldType)
73+
jsonName := jsonFieldName(&fieldType)
7474
if jsonName == "" {
7575
continue
7676
}
@@ -99,13 +99,13 @@ func reflectValueToInterface(v reflect.Value) interface{} {
9999
return v.Interface()
100100
}
101101

102-
func jsonFieldName(field reflect.StructField) string {
103-
tag := field.Tag.Get("json")
102+
func jsonFieldName(fld *reflect.StructField) string {
103+
tag := fld.Tag.Get("json")
104104
if tag == "-" {
105105
return ""
106106
}
107107
if tag == "" {
108-
return field.Name
108+
return fld.Name
109109
}
110110
return strings.Split(tag, ",")[0]
111111
}

0 commit comments

Comments
 (0)