mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
libnetwork/networkdb: make switches exhaustive (exhaustive)
Adding a `default` statement so that disabling the "default-signifies-exhaustive"
linter option will make it show up.
libnetwork/networkdb/delegate.go:49:2: missing cases in switch of type networkdb.NodeEvent_Type: networkdb.NodeEventTypeInvalid (exhaustive)
switch nEvent.Type {
^
libnetwork/networkdb/delegate.go:223:2: missing cases in switch of type networkdb.TableEvent_Type: networkdb.TableEventTypeInvalid (exhaustive)
switch tEvent.Type {
^
libnetwork/networkdb/nodemgmt.go:51:2: missing cases in switch of type networkdb.nodeState: networkdb.nodeNotFound (exhaustive)
switch newState {
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -67,9 +67,10 @@ func (nDB *NetworkDB) handleNodeEvent(nEvent *NodeEvent) bool {
|
||||
log.G(context.TODO()).Infof("%v(%v): Node leave event for %s/%s", nDB.config.Hostname, nDB.config.NodeID, n.Name, n.Addr)
|
||||
}
|
||||
return moved
|
||||
default:
|
||||
// TODO(thaJeztah): make switch exhaustive; add networkdb.NodeEventTypeInvalid
|
||||
return false
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (nDB *NetworkDB) handleNetworkEvent(nEvent *NetworkEvent) bool {
|
||||
@@ -227,6 +228,8 @@ func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent, isBulkSync bool) bool
|
||||
op = opUpdate
|
||||
case TableEventTypeDelete:
|
||||
op = opDelete
|
||||
default:
|
||||
// TODO(thaJeztah): make switch exhaustive; add networkdb.TableEventTypeInvalid
|
||||
}
|
||||
|
||||
nDB.broadcaster.Write(makeEvent(op, tEvent.TableName, tEvent.NetworkID, tEvent.Key, tEvent.Value))
|
||||
|
||||
@@ -72,6 +72,8 @@ func (nDB *NetworkDB) changeNodeState(nodeName string, newState nodeState) (bool
|
||||
|
||||
delete(m, nodeName)
|
||||
nDB.failedNodes[nodeName] = n
|
||||
default:
|
||||
// TODO(thaJeztah): make switch exhaustive; add networkdb.nodeNotFound
|
||||
}
|
||||
|
||||
log.G(context.TODO()).Infof("Node %s change state %s --> %s", nodeName, nodeStateName[currState], nodeStateName[newState])
|
||||
|
||||
Reference in New Issue
Block a user