diff --git a/grace.go b/grace.go index d78a27e..81e5875 100644 --- a/grace.go +++ b/grace.go @@ -148,11 +148,11 @@ func Wait(listeners []Listener) (err error) { wg.Add(len(listeners)) for _, l := range listeners { go func(l Listener) { + defer wg.Done() cErr := l.Close() if cErr != nil { err = cErr } - wg.Done() }(l) } wg.Wait()