Skip to content

Commit

Permalink
Check error returned from client-go/SharedInformer.AddEventHandler
Browse files Browse the repository at this point in the history
Fix lint error:
Error: kubernetes/pods.go:53:26: Error return value of
`informer.AddEventHandler` is not checked (errcheck)

Signed-off-by: Katyanna Moura <[email protected]>
  • Loading branch information
katyanna committed Oct 19, 2023
1 parent b1a6d7a commit 73465ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kubernetes/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (a *Adapter) PodInformer(ctx context.Context, endpointChan chan<- []string)
queueEndpoints(&podEndpoints, endpointChan)

// delta triggered updates
informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
_, err = informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
UpdateFunc: func(_, newResource interface{}) {
pod, ok := newResource.(*corev1.Pod)
if !ok {
Expand All @@ -76,6 +76,9 @@ func (a *Adapter) PodInformer(ctx context.Context, endpointChan chan<- []string)
}
},
})
if err != nil {
return err
}
<-ctx.Done()
return nil
}
Expand Down

0 comments on commit 73465ee

Please sign in to comment.