From 220ebb1f4faffd7a95bdb6098454f80afb5c9941 Mon Sep 17 00:00:00 2001 From: Naitik Shah Date: Sun, 6 Oct 2013 10:54:16 -0700 Subject: [PATCH] use defer in conn.Close --- grace.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/grace.go b/grace.go index a7394aa..a80fbb2 100644 --- a/grace.go +++ b/grace.go @@ -58,9 +58,8 @@ type conn struct { } func (c conn) Close() error { - err := c.Conn.Close() - c.wg.Done() - return err + defer c.wg.Done() + return c.Conn.Close() } // Wraps an existing File listener to provide a graceful Close() process.