From f2447bd4c35573d40e2ef678809657c5a1d4e999 Mon Sep 17 00:00:00 2001
From: GagziW <leon.stanko@rwth-aachen.de>
Date: Thu, 3 May 2018 01:33:39 -0700
Subject: [PATCH] p2p: changed if-else blocks to conform with golint (#16660)

---
 p2p/message.go             | 29 ++++++++++++++---------------
 p2p/simulations/network.go |  3 +--
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/p2p/message.go b/p2p/message.go
index 50b419970..ffa2ef86a 100644
--- a/p2p/message.go
+++ b/p2p/message.go
@@ -229,21 +229,20 @@ func ExpectMsg(r MsgReader, code uint64, content interface{}) error {
 	}
 	if content == nil {
 		return msg.Discard()
-	} else {
-		contentEnc, err := rlp.EncodeToBytes(content)
-		if err != nil {
-			panic("content encode error: " + err.Error())
-		}
-		if int(msg.Size) != len(contentEnc) {
-			return fmt.Errorf("message size mismatch: got %d, want %d", msg.Size, len(contentEnc))
-		}
-		actualContent, err := ioutil.ReadAll(msg.Payload)
-		if err != nil {
-			return err
-		}
-		if !bytes.Equal(actualContent, contentEnc) {
-			return fmt.Errorf("message payload mismatch:\ngot:  %x\nwant: %x", actualContent, contentEnc)
-		}
+	}
+	contentEnc, err := rlp.EncodeToBytes(content)
+	if err != nil {
+		panic("content encode error: " + err.Error())
+	}
+	if int(msg.Size) != len(contentEnc) {
+		return fmt.Errorf("message size mismatch: got %d, want %d", msg.Size, len(contentEnc))
+	}
+	actualContent, err := ioutil.ReadAll(msg.Payload)
+	if err != nil {
+		return err
+	}
+	if !bytes.Equal(actualContent, contentEnc) {
+		return fmt.Errorf("message payload mismatch:\ngot:  %x\nwant: %x", actualContent, contentEnc)
 	}
 	return nil
 }
diff --git a/p2p/simulations/network.go b/p2p/simulations/network.go
index caf428ece..0983e0a85 100644
--- a/p2p/simulations/network.go
+++ b/p2p/simulations/network.go
@@ -738,7 +738,6 @@ func (self *Network) executeNodeEvent(e *Event) error {
 func (self *Network) executeConnEvent(e *Event) error {
 	if e.Conn.Up {
 		return self.Connect(e.Conn.One, e.Conn.Other)
-	} else {
-		return self.Disconnect(e.Conn.One, e.Conn.Other)
 	}
+	return self.Disconnect(e.Conn.One, e.Conn.Other)
 }
-- 
GitLab