Use range in loops; misc fixes

Kubernetes-commit: c23a8a85cce80a1015797e9c76aae709d9910791
This commit is contained in:
Mikhail Mazurskiy 2018-03-29 22:55:25 +11:00 committed by Kubernetes Publisher
parent 991626bd9b
commit 37d44da37d

View File

@ -225,11 +225,7 @@ func (eventBroadcaster *eventBroadcasterImpl) StartEventWatcher(eventHandler fun
watcher := eventBroadcaster.Watch()
go func() {
defer utilruntime.HandleCrash()
for {
watchEvent, open := <-watcher.ResultChan()
if !open {
return
}
for watchEvent := range watcher.ResultChan() {
event, ok := watchEvent.Object.(*v1.Event)
if !ok {
// This is all local, so there's no reason this should