Merge pull request #1484 from titanous/use-range

Use ranged for loop on channels
This commit is contained in:
Michael Crosby 2013-08-09 18:06:12 -07:00
commit 3e12349831
2 changed files with 2 additions and 4 deletions

3
api.go
View File

@ -236,8 +236,7 @@ func getEvents(srv *Server, version float64, w http.ResponseWriter, r *http.Requ
} }
} }
} }
for { for event := range listener {
event := <-listener
err := sendEvent(wf, &event) err := sendEvent(wf, &event)
if err != nil && err.Error() == "JSON error" { if err != nil && err.Error() == "JSON error" {
continue continue

View File

@ -1728,8 +1728,7 @@ func (cli *DockerCli) monitorTtySize(id string) error {
sigchan := make(chan os.Signal, 1) sigchan := make(chan os.Signal, 1)
signal.Notify(sigchan, syscall.SIGWINCH) signal.Notify(sigchan, syscall.SIGWINCH)
go func() { go func() {
for { for _ = range sigchan {
<-sigchan
cli.resizeTty(id) cli.resizeTty(id)
} }
}() }()