Skip to content

Commit 574a42d

Browse files
committed
check type casting for go-lint
Signed-off-by: Swati Gupta <[email protected]>
1 parent cc65465 commit 574a42d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/compute-domain-controller/computedomain.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ func (m *ComputeDomainManager) Start(ctx context.Context) (rerr error) {
9999

100100
_, err = m.informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
101101
AddFunc: func(obj any) {
102-
cd := obj.(*nvapi.ComputeDomain)
102+
cd, ok := obj.(*nvapi.ComputeDomain)
103+
if !ok {
104+
return fmt.Errorf("failed to cast to ComputeDomain")
105+
}
103106
klog.Infof("ComputeDomain %s/%s added to work queue", cd.Namespace, cd.Name)
104107
m.config.workQueue.Enqueue(obj, m.onAddOrUpdate)
105108
},

0 commit comments

Comments
 (0)