From e41ce4eed01ec82784ef6d6d1b4180f28fe1a50a Mon Sep 17 00:00:00 2001 From: Iskander Sharipov Date: Thu, 13 Sep 2018 22:38:59 +0300 Subject: [PATCH] proxy: fix type switch case order Type switch cases matched sequentially, one after another, so concrete types should go before interfaces they implement, otherwise their bodies will be never executed. Found using https://go-critic.github.io/overview#caseOrder-ref --- proxy/io.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/io.go b/proxy/io.go index 3b8fb2a..340c5f7 100644 --- a/proxy/io.go +++ b/proxy/io.go @@ -129,11 +129,11 @@ REPEAT: goto REPEAT case *udpBridgeConn: srcConn = src.(*udpBridgeConn) - case net.Conn: - srcConn = src.(net.Conn) case *tcpmux.Stream: // Stream has its own management of timeout return + case net.Conn: + srcConn = src.(net.Conn) default: return }