From f5f9ffe9814f94f229c57cbf8c9de5e55b6218ec Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 18 Dec 2016 10:19:31 -0500 Subject: [PATCH] Do not break out of a switch, use return. --- pop3/conn.go | 4 ++-- smtp/conn.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pop3/conn.go b/pop3/conn.go index 55fc01a..5071e78 100644 --- a/pop3/conn.go +++ b/pop3/conn.go @@ -56,7 +56,7 @@ func AcceptConnection(netConn net.Conn, po PostOffice, log zap.Logger) { if err != nil { conn.log.Error("ReadLine()", zap.Error(err)) conn.tp.Close() - break + return } var cmd string @@ -68,7 +68,7 @@ func AcceptConnection(netConn net.Conn, po PostOffice, log zap.Logger) { switch strings.ToUpper(cmd) { case "QUIT": conn.doQUIT() - break + return case "USER": conn.doUSER() case "PASS": diff --git a/smtp/conn.go b/smtp/conn.go index 8b4f124..0eb3bc9 100644 --- a/smtp/conn.go +++ b/smtp/conn.go @@ -62,7 +62,7 @@ func AcceptConnection(netConn net.Conn, server Server, log zap.Logger) { if err != nil { conn.log.Error("ReadLine()", zap.Error(err)) conn.tp.Close() - break + return } conn.log.Info("ReadLine()", zap.String("line", conn.line)) @@ -77,7 +77,7 @@ func AcceptConnection(netConn net.Conn, server Server, log zap.Logger) { case "QUIT": conn.writeReply(221, "Goodbye") conn.tp.Close() - break + return case "HELO": conn.esmtp = false fallthrough -- 2.43.5