1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Make the chan for utils.Go buffered in order to avoid goroutine leak

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
This commit is contained in:
Guillaume J. Charmes 2014-02-28 16:35:43 -08:00
parent 5f5880edb8
commit d3a6ee1e55
No known key found for this signature in database
GPG key ID: B33E4642CB6E3FF3

View file

@ -33,7 +33,7 @@ type Fataler interface {
// Go is a basic promise implementation: it wraps calls a function in a goroutine,
// and returns a channel which will later return the function's return value.
func Go(f func() error) chan error {
ch := make(chan error)
ch := make(chan error, 1)
go func() {
ch <- f()
}()