diff --git a/service/listener_test.go b/service/listener_test.go index 35173fbf1..c21c0f690 100644 --- a/service/listener_test.go +++ b/service/listener_test.go @@ -61,15 +61,18 @@ var _ = Describe("Service Listener", func() { go func() { defer GinkgoRecover() - var c net.Conn + var ( + conn net.Conn + err error // separate var to avoid data-race + ) By("accepting client connection", func() { - c, err = l.Accept() + conn, err = l.Accept() Expect(err).Should(Succeed()) - DeferCleanup(c.Close) + DeferCleanup(conn.Close) }) By("sending data to the client", func() { - Expect(c.Write(data)).Should(Equal(len(data))) + Expect(conn.Write(data)).Should(Equal(len(data))) }) close(ch)