mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-13 22:01:43 +00:00
Merge pull request #61894 from atlassian/misc-cleanups
Automatic merge from submit-queue (batch tested with PRs 61894, 61369). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Use range in loops; misc fixes **What this PR does / why we need it**: It is cleaner to use `range` in for loops to iterate over channel until it is closed. **Release note**: ```release-note NONE ``` /kind cleanup Kubernetes-commit: 7ce753aa73a42d8a8696659e345e173d15cce622
This commit is contained in:
1160
Godeps/Godeps.json
generated
1160
Godeps/Godeps.json
generated
File diff suppressed because it is too large
Load Diff
@@ -225,11 +225,7 @@ func (eventBroadcaster *eventBroadcasterImpl) StartEventWatcher(eventHandler fun
|
|||||||
watcher := eventBroadcaster.Watch()
|
watcher := eventBroadcaster.Watch()
|
||||||
go func() {
|
go func() {
|
||||||
defer utilruntime.HandleCrash()
|
defer utilruntime.HandleCrash()
|
||||||
for {
|
for watchEvent := range watcher.ResultChan() {
|
||||||
watchEvent, open := <-watcher.ResultChan()
|
|
||||||
if !open {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
event, ok := watchEvent.Object.(*v1.Event)
|
event, ok := watchEvent.Object.(*v1.Event)
|
||||||
if !ok {
|
if !ok {
|
||||||
// This is all local, so there's no reason this should
|
// This is all local, so there's no reason this should
|
||||||
|
Reference in New Issue
Block a user