Skip to content

Commit 299d577

Browse files
chore(deps): update dependency golangci/golangci-lint to v2.5.0 (#46)
* chore(deps): update dependency golangci/golangci-lint to v2.5.0 * Fix lint errors Signed-off-by: Jonathan Ogilvie <[email protected]> --------- Signed-off-by: Jonathan Ogilvie <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Ogilvie <[email protected]>
1 parent c7af52c commit 299d577

21 files changed

+124
-5
lines changed

Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ go-test:
238238

239239
# go-lint lints Go code.
240240
go-lint:
241-
ARG GOLANGCI_LINT_VERSION=v2.4.0
241+
ARG GOLANGCI_LINT_VERSION=v2.5.0
242242
FROM +go-modules
243243
# This cache is private because golangci-lint doesn't support concurrent runs.
244244
CACHE --id go-lint --sharing private /root/.cache/golangci-lint

cmd/diff/client/crossplane/composition_client_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
173173
res: func() *un.Unstructured {
174174
xr := tu.NewResource("example.org/v1", "XR1", "my-xr").Build()
175175
_ = un.SetNestedField(xr.Object, "referenced-comp", "spec", "compositionRef", "name")
176+
176177
return xr
177178
}(),
178179
},
@@ -202,6 +203,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
202203
res: func() *un.Unstructured {
203204
xr := tu.NewResource("example.org/v1", "XR1", "my-xr").Build()
204205
_ = un.SetNestedField(xr.Object, "incompatible-comp", "spec", "compositionRef", "name")
206+
205207
return xr
206208
}(),
207209
},
@@ -230,6 +232,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
230232
res: func() *un.Unstructured {
231233
xr := tu.NewResource("example.org/v1", "XR1", "my-xr").Build()
232234
_ = un.SetNestedField(xr.Object, "non-existent-comp", "spec", "compositionRef", "name")
235+
233236
return xr
234237
}(),
235238
},
@@ -261,6 +264,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
261264
_ = un.SetNestedStringMap(xr.Object, map[string]string{
262265
"environment": "production",
263266
}, "spec", "compositionSelector", "matchLabels")
267+
264268
return xr
265269
}(),
266270
},
@@ -288,6 +292,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
288292
comp.SetLabels(map[string]string{
289293
"environment": "staging",
290294
})
295+
291296
return comp
292297
}(),
293298
},
@@ -299,6 +304,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
299304
_ = un.SetNestedStringMap(xr.Object, map[string]string{
300305
"environment": "production",
301306
}, "spec", "compositionSelector", "matchLabels")
307+
302308
return xr
303309
}(),
304310
},
@@ -330,6 +336,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
330336
_ = un.SetNestedStringMap(xr.Object, map[string]string{
331337
"environment": "production",
332338
}, "spec", "compositionSelector", "matchLabels")
339+
333340
return xr
334341
}(),
335342
},
@@ -378,6 +385,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
378385
res: func() *un.Unstructured {
379386
xr := tu.NewResource("example.org/v1", "XR1", "my-xr").Build()
380387
_ = un.SetNestedField(xr.Object, "referenced-comp", "spec", "compositionRef", "name")
388+
381389
return xr
382390
}(),
383391
},
@@ -406,6 +414,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
406414
_ = un.SetNestedStringMap(xr.Object, map[string]string{
407415
"environment": "production",
408416
}, "spec", "compositionSelector", "matchLabels")
417+
409418
return xr
410419
}(),
411420
},
@@ -497,6 +506,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
497506
}).Build(),
498507
}, nil
499508
}
509+
500510
return []*un.Unstructured{}, nil
501511
}).
502512
Build(),
@@ -599,6 +609,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
599609
}).Build(),
600610
}, nil
601611
}
612+
602613
return []*un.Unstructured{}, nil
603614
}).
604615
Build(),
@@ -688,6 +699,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
688699
}).Build(),
689700
}, nil
690701
}
702+
691703
return []*un.Unstructured{}, nil
692704
}).
693705
Build(),
@@ -798,13 +810,17 @@ func TestDefaultCompositionClient_GetComposition(t *testing.T) {
798810
u := &un.Unstructured{}
799811
u.SetGroupVersionKind(gvk)
800812
u.SetName(name)
813+
801814
obj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(testComp)
802815
if err != nil {
803816
return nil, err
804817
}
818+
805819
u.SetUnstructuredContent(obj)
820+
806821
return u, nil
807822
}
823+
808824
return nil, errors.New("composition not found")
809825
}).
810826
Build()
@@ -920,6 +936,7 @@ func TestDefaultCompositionClient_ListCompositions(t *testing.T) {
920936
if gvk.Group == CrossplaneAPIExtGroup && gvk.Kind == "Composition" {
921937
return []*un.Unstructured{u1, u2}, nil
922938
}
939+
923940
return nil, errors.New("unexpected GVK")
924941
}).
925942
Build(),

cmd/diff/client/crossplane/definition_client_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func TestDefaultDefinitionClient_GetXRDs(t *testing.T) {
6464
if gvk.Group == CrossplaneAPIExtGroup && gvk.Kind == CompositeResourceDefinitionKind {
6565
return []*un.Unstructured{}, nil
6666
}
67+
6768
return nil, errors.New("unexpected GVK")
6869
}).
6970
Build(),
@@ -83,6 +84,7 @@ func TestDefaultDefinitionClient_GetXRDs(t *testing.T) {
8384
if gvk.Group == CrossplaneAPIExtGroup && gvk.Kind == CompositeResourceDefinitionKind && gvk.Version == "v1" {
8485
return []*un.Unstructured{xrd1, xrd2}, nil
8586
}
87+
8688
return nil, errors.New("unexpected GVK")
8789
}).
8890
Build(),

cmd/diff/client/crossplane/environment_client_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func TestDefaultEnvironmentClient_GetEnvironmentConfigs(t *testing.T) {
6060
gvk.Kind == "EnvironmentConfig" {
6161
return []*un.Unstructured{}, nil
6262
}
63+
6364
return nil, errors.New("unexpected GVK")
6465
}).
6566
Build(),
@@ -76,6 +77,7 @@ func TestDefaultEnvironmentClient_GetEnvironmentConfigs(t *testing.T) {
7677
gvk.Kind == "EnvironmentConfig" {
7778
return []*un.Unstructured{envConfig1, envConfig2}, nil
7879
}
80+
7981
return nil, errors.New("unexpected GVK")
8082
}).
8183
Build(),
@@ -219,6 +221,7 @@ func TestDefaultEnvironmentClient_GetEnvironmentConfig(t *testing.T) {
219221
name == "test-env-config" {
220222
return envConfig, nil
221223
}
224+
222225
return nil, errors.New("unexpected resource request")
223226
}).
224227
Build(),
@@ -320,6 +323,7 @@ func TestDefaultEnvironmentClient_Initialize(t *testing.T) {
320323
gvk.Kind == "EnvironmentConfig" {
321324
return []*un.Unstructured{envConfig1, envConfig2}, nil
322325
}
326+
323327
return nil, errors.New("unexpected GVK")
324328
}).
325329
Build(),

cmd/diff/client/crossplane/function_client_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ func TestDefaultFunctionClient_ListFunctions(t *testing.T) {
373373
if gvk.Group == "pkg.crossplane.io" && gvk.Kind == "Function" {
374374
return []*un.Unstructured{u1, u2}, nil
375375
}
376+
376377
return nil, errors.New("unexpected GVK")
377378
}).
378379
Build(),
@@ -409,6 +410,7 @@ func TestDefaultFunctionClient_ListFunctions(t *testing.T) {
409410
invalid.SetName("invalid")
410411
// Put invalid data to force conversion failure
411412
invalid.Object["spec"] = 123 // This will cause conversion to fail since spec should be a map
413+
412414
return []*un.Unstructured{invalid}, nil
413415
}).
414416
Build(),
@@ -540,6 +542,7 @@ func TestDefaultFunctionClient_Initialize(t *testing.T) {
540542
if gvk.Group == "pkg.crossplane.io" && gvk.Kind == "Function" {
541543
return []*un.Unstructured{u1, u2}, nil
542544
}
545+
543546
return nil, errors.New("unexpected GVK")
544547
}).
545548
Build(),

cmd/diff/client/kubernetes/apply_client_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func TestApplyClient_DryRunApply(t *testing.T) {
5353
// For apply, we'd return the "server-modified" version
5454
result := obj.DeepCopy()
5555
result.SetResourceVersion("1000") // Server would set this
56+
5657
return true, result, nil
5758
})
5859

@@ -96,6 +97,7 @@ func TestApplyClient_DryRunApply(t *testing.T) {
9697
// For apply, we'd return the "server-modified" version
9798
result := obj.DeepCopy()
9899
result.SetResourceVersion("1000") // Server would set this
100+
99101
return true, result, nil
100102
})
101103

cmd/diff/client/kubernetes/schema_client_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ func TestSchemaClient_GetCRD(t *testing.T) {
199199
if getAction.GetName() == testXResourcePlural+".example.org" {
200200
return true, testCRDUnstructured, nil
201201
}
202+
202203
return false, nil, nil
203204
})
204205

@@ -378,6 +379,7 @@ func TestSchemaClient_LoadCRDsFromXRDs(t *testing.T) {
378379
if getAction.GetName() == testXResourcePlural+".example.org" {
379380
return true, correspondingCRD, nil
380381
}
382+
381383
return false, nil, nil
382384
})
383385

@@ -809,10 +811,12 @@ func TestSchemaClient_CachingBehavior(t *testing.T) {
809811
dynamicClient := fake.NewSimpleDynamicClient(scheme)
810812
dynamicClient.PrependReactor("get", "customresourcedefinitions", func(action kt.Action) (bool, runtime.Object, error) {
811813
callCount++
814+
812815
getAction := action.(kt.GetAction)
813816
if getAction.GetName() == testXResourcePlural+".example.org" {
814817
return true, testCRDUnstructured, nil
815818
}
819+
816820
return false, nil, nil
817821
})
818822

@@ -851,10 +855,12 @@ func TestSchemaClient_CachingBehavior(t *testing.T) {
851855
dynamicClient := fake.NewSimpleDynamicClient(scheme)
852856
dynamicClient.PrependReactor("get", "customresourcedefinitions", func(action kt.Action) (bool, runtime.Object, error) {
853857
callCount++
858+
854859
getAction := action.(kt.GetAction)
855860
if getAction.GetName() == testXResourcePlural+".example.org" {
856861
return true, testCRDUnstructured, nil
857862
}
863+
858864
return false, nil, nil
859865
})
860866

cmd/diff/cmd_utils.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package main contains shared command utilities.
1817
package main
1918

2019
import (

cmd/diff/comp.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package main contains the composition diff command.
1817
package main
1918

2019
import (

0 commit comments

Comments
 (0)