Merge pull request #1217 from unihorn/146

main: not use loop variable in goroutine in loop body
This commit is contained in:
Yicheng Qin 2014-10-01 11:25:53 -07:00
commit fd758c71b8

View File

@ -220,8 +220,9 @@ func startEtcd() {
} }
// Start the peer server in a goroutine // Start the peer server in a goroutine
urlStr := u.String()
go func() { go func() {
log.Print("Listening for peers on ", u.String()) log.Print("Listening for peers on ", urlStr)
log.Fatal(http.Serve(l, ph)) log.Fatal(http.Serve(l, ph))
}() }()
} }
@ -233,8 +234,9 @@ func startEtcd() {
log.Fatal(err) log.Fatal(err)
} }
urlStr := u.String()
go func() { go func() {
log.Print("Listening for client requests on ", u.String()) log.Print("Listening for client requests on ", urlStr)
log.Fatal(http.Serve(l, ch)) log.Fatal(http.Serve(l, ch))
}() }()
} }
@ -268,8 +270,9 @@ func startProxy() {
log.Fatal(err) log.Fatal(err)
} }
host := u.Host
go func() { go func() {
log.Print("Listening for client requests on ", u.Host) log.Print("Listening for client requests on ", host)
log.Fatal(http.Serve(l, ph)) log.Fatal(http.Serve(l, ph))
}() }()
} }