From 906a8cad5516da566d1e25e245635648fe903d4c Mon Sep 17 00:00:00 2001 From: rubyist Date: Mon, 4 Nov 2013 06:57:07 -0500 Subject: [PATCH] Move defer outside the closure --- grace.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grace.go b/grace.go index c4eaa9b..5032998 100644 --- a/grace.go +++ b/grace.go @@ -64,7 +64,7 @@ type conn struct { } func (c *conn) Close() error { - c.once.Do(func() { defer c.wg.Done() }) + defer c.once.Do(c.wg.Done) return c.Conn.Close() }