Skip to content

Commit 596172c

Browse files
committed
fix linter errors
1 parent be1010f commit 596172c

File tree

7 files changed

+21
-20
lines changed

7 files changed

+21
-20
lines changed

adopt/adopt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ const Owned = "owned"
8686

8787
var (
8888
// AlwaysExistsFunc is an ExistsFunc that always returns nil
89-
AlwaysExistsFunc ExistsFunc = func(ctx context.Context, nn types.NamespacedName) error {
89+
AlwaysExistsFunc ExistsFunc = func(_ context.Context, _ types.NamespacedName) error {
9090
return nil
9191
}
9292
// NoopObjectMissingFunc is an ObjectMissing func that does nothing
93-
NoopObjectMissingFunc = func(ctx context.Context, err error) {}
93+
NoopObjectMissingFunc = func(_ context.Context, _ error) {}
9494
)
9595

9696
// AdoptionHandler implements handler.Handler to "adopt" an existing resource

adopt/adopt_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,21 +324,21 @@ func TestSecretAdopterHandler(t *testing.T) {
324324
applyCallIndex := 0
325325
s := NewSecretAdoptionHandler(
326326
recorder,
327-
func(ctx context.Context) (*corev1.Secret, error) {
327+
func(_ context.Context) (*corev1.Secret, error) {
328328
return tt.secretInCache, tt.cacheErr
329329
},
330-
func(ctx context.Context, err error) {
330+
func(_ context.Context, err error) {
331331
require.Equal(t, tt.expectObjectMissingErr, err)
332332
},
333333
typed.NewIndexer[*corev1.Secret](indexer),
334-
func(ctx context.Context, secret *applycorev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *corev1.Secret, err error) {
334+
func(_ context.Context, secret *applycorev1.SecretApplyConfiguration, _ metav1.ApplyOptions) (result *corev1.Secret, err error) {
335335
defer func() { applyCallIndex++ }()
336336
call := tt.applyCalls[applyCallIndex]
337337
call.called = true
338338
require.Equal(t, call.input, secret, "error on call %d", applyCallIndex)
339339
return call.result, call.err
340340
},
341-
func(ctx context.Context, nn types.NamespacedName) error {
341+
func(_ context.Context, _ types.NamespacedName) error {
342342
return tt.secretExistsErr
343343
},
344344
handler.NewHandlerFromFunc(func(ctx context.Context) {

bootstrap/crds.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func waitForDiscovery(ctx context.Context, config *rest.Config, crds []*apiexten
117117
return err
118118
}
119119

120-
return wait.PollUntilContextTimeout(ctx, crdInstallPollInterval, maxCRDInstallTime, true, func(ctx context.Context) (done bool, err error) {
120+
return wait.PollUntilContextTimeout(ctx, crdInstallPollInterval, maxCRDInstallTime, true, func(_ context.Context) (done bool, err error) {
121121
_, serverGVRs, err := discoveryClient.ServerGroupsAndResources()
122122
if err != nil {
123123
return false, nil

component/ensure_component_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,23 +137,23 @@ func TestEnsureServiceHandler(t *testing.T) {
137137
NewIndexedComponent(
138138
indexer,
139139
ownerIndex,
140-
func(ctx context.Context) labels.Selector {
140+
func(_ context.Context) labels.Selector {
141141
return labels.SelectorFromSet(map[string]string{
142142
"example.com/component": "the-main-service-component",
143143
})
144144
}),
145145
hash.NewObjectHash(), hashKey),
146146
ctxOwner,
147147
queueOps,
148-
func(ctx context.Context, apply *applycorev1.ServiceApplyConfiguration) (*corev1.Service, error) {
148+
func(_ context.Context, _ *applycorev1.ServiceApplyConfiguration) (*corev1.Service, error) {
149149
applyCalled = true
150150
return nil, nil
151151
},
152-
func(ctx context.Context, nn types.NamespacedName) error {
152+
func(_ context.Context, _ types.NamespacedName) error {
153153
deleteCalled = true
154154
return nil
155155
},
156-
func(ctx context.Context) *applycorev1.ServiceApplyConfiguration {
156+
func(_ context.Context) *applycorev1.ServiceApplyConfiguration {
157157
return applycorev1.Service("test", "test").
158158
WithLabels(map[string]string{
159159
"example.com/component": "the-main-service-component",

manager/controller_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func ExampleNewOwnedResourceController() {
3232

3333
// the controller processes objects on the queue, but doesn't set up any
3434
// informers by default.
35-
controller := NewOwnedResourceController(klogr.New(), "my-controller", gvr, CtxQueue, registry, broadcaster, func(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) {
36-
// process object
35+
controller := NewOwnedResourceController(klogr.New(), "my-controller", gvr, CtxQueue, registry, broadcaster, func(_ context.Context, gvr schema.GroupVersionResource, namespace, name string) {
36+
fmt.Println("processing", gvr, namespace, name)
3737
})
3838

3939
mgr := NewManager(ctrlmanageropts.RecommendedDebuggingOptions().DebuggingConfiguration, ":", broadcaster, eventSink)
@@ -54,7 +54,8 @@ func TestControllerQueueDone(t *testing.T) {
5454
broadcaster := record.NewBroadcaster()
5555
eventSink := &typedcorev1.EventSinkImpl{Interface: fake.NewSimpleClientset().CoreV1().Events("")}
5656

57-
controller := NewOwnedResourceController(klogr.New(), "my-controller", gvr, CtxQueue, registry, broadcaster, func(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) {
57+
controller := NewOwnedResourceController(klogr.New(), "my-controller", gvr, CtxQueue, registry, broadcaster, func(_ context.Context, gvr schema.GroupVersionResource, namespace, name string) {
58+
fmt.Println("processing", gvr, namespace, name)
5859
})
5960

6061
mgr := NewManager(ctrlmanageropts.RecommendedDebuggingOptions().DebuggingConfiguration, ":", broadcaster, eventSink)

pause/pause_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func ExampleNewPauseContextHandler() {
4444
queueOperations.Key,
4545
"example.com/paused",
4646
ctxObject,
47-
func(ctx context.Context, patch *MyObject) error {
47+
func(_ context.Context, _ *MyObject) error {
4848
// update status
4949
return nil
5050
},
@@ -184,7 +184,7 @@ func TestPauseHandler(t *testing.T) {
184184
ctrls := &fake.FakeInterface{}
185185
patchCalled := false
186186

187-
patchStatus := func(ctx context.Context, patch *MyObject) error {
187+
patchStatus := func(_ context.Context, patch *MyObject) error {
188188
patchCalled = true
189189

190190
if tt.patchError != nil {
@@ -209,7 +209,7 @@ func TestPauseHandler(t *testing.T) {
209209
ctx = ctxMyObject.WithValue(ctx, tt.obj)
210210
var called handler.Key
211211

212-
NewPauseContextHandler(queueOps.Key, PauseLabelKey, ctxMyObject, patchStatus, handler.ContextHandlerFunc(func(ctx context.Context) {
212+
NewPauseContextHandler(queueOps.Key, PauseLabelKey, ctxMyObject, patchStatus, handler.ContextHandlerFunc(func(_ context.Context) {
213213
called = nextKey
214214
})).Handle(ctx)
215215

static/controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ func NewStaticController[K bootstrap.KubeResourceObject](log logr.Logger, name s
4949
func (c *Controller[K]) Start(ctx context.Context, _ int) {
5050
inf := c.fileInformerFactory.ForResource(c.staticClusterResource).Informer()
5151
_, err := inf.AddEventHandler(cache.ResourceEventHandlerFuncs{
52-
AddFunc: func(obj interface{}) { c.handleStaticResource(ctx) },
53-
UpdateFunc: func(_, obj interface{}) { c.handleStaticResource(ctx) },
54-
DeleteFunc: func(obj interface{}) { c.handleStaticResource(ctx) },
52+
AddFunc: func(_ any) { c.handleStaticResource(ctx) },
53+
UpdateFunc: func(_, _ any) { c.handleStaticResource(ctx) },
54+
DeleteFunc: func(_ any) { c.handleStaticResource(ctx) },
5555
})
5656
if err != nil {
5757
panic("failed to add handlers: " + err.Error())

0 commit comments

Comments
 (0)