From 7801c6a2739564296e41e7d5008eeba392d2e280 Mon Sep 17 00:00:00 2001 From: Louis Date: Sat, 8 Oct 2022 08:55:53 -0700 Subject: [PATCH] nit: defer after error check (#127) --- utils/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/utils.go b/utils/utils.go index 50a1217..d4bbef2 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -128,10 +128,10 @@ func UDPStoppableRoutine(stopCh <-chan struct{}, name string, decodeFunc decoder if sockReuse { pconn, err := reuseport.ListenPacket("udp", addrUDP.String()) - defer pconn.Close() if err != nil { return err } + defer pconn.Close() var ok bool udpconn, ok = pconn.(*net.UDPConn) if !ok {