Skip to content

Commit

Permalink
Fix linter bug
Browse files Browse the repository at this point in the history
Signed-off-by: Nadia Pinaeva <[email protected]>
  • Loading branch information
npinaeva committed Nov 23, 2023
1 parent 21b3bcb commit 7d8d811
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions go-controller/pkg/clustermanager/status_manager/status_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ func NewStatusManager(wf *factory.WatchFactory, ovnClient *util.OVNClusterManage
)
sm.typedManagers["egressfirewalls"] = egressFirewallManager
}

linterHack{}.hack()
return sm
}

Expand Down Expand Up @@ -253,3 +255,27 @@ func (sm *StatusManager) withZonesRLock(f func(zones sets.Set[string]) error) er
defer sm.zonesLock.RUnlock()
return f(sm.zones)
}

// linter reports methods of generic interfaces as unused, even though they are used.
// https://github.com/dominikh/go-tools/issues/1440
// Until the bug is fixed, make linter happy by "using" interface implementation methods.
type linterHack struct {
apbrouteManager apbRouteManager
egressfirewallManager egressFirewallManager
toRun bool
}

func (l linterHack) hack() {
// toRun if always false
if l.toRun {
_, _ = l.apbrouteManager.get("a", "b")
l.apbrouteManager.getMessages(nil)
_ = l.apbrouteManager.updateStatus(nil, nil, false)
_ = l.apbrouteManager.cleanupStatus(nil, nil)

_, _ = l.egressfirewallManager.get("a", "b")
l.egressfirewallManager.getMessages(nil)
_ = l.egressfirewallManager.updateStatus(nil, nil, false)
_ = l.egressfirewallManager.cleanupStatus(nil, nil)
}
}

0 comments on commit 7d8d811

Please sign in to comment.