From fe03b76ffe9f9d48b09f4d93f18fae1e5ad4c1f4 Mon Sep 17 00:00:00 2001
From: Ferenc Szabo <frncmx@gmail.com>
Date: Sun, 6 Jan 2019 11:58:57 +0100
Subject: A few minor code inspection fixes (#18393)

* swarm/network: fix code inspection problems

- typos
- redundant import alias

* p2p/simulations: fix code inspection problems

- typos
- unused function parameters
- redundant import alias
- code style issue: snake case

* swarm/network: fix unused method parameters inspections
---
 p2p/simulations/adapters/exec.go   |  2 +-
 p2p/simulations/adapters/inproc.go |  2 +-
 p2p/simulations/connect_test.go    |  1 +
 p2p/simulations/http_test.go       |  3 ++-
 p2p/simulations/mocker_test.go     | 14 +++++++-------
 p2p/simulations/network.go         |  6 +++---
 6 files changed, 15 insertions(+), 13 deletions(-)

(limited to 'p2p')

diff --git a/p2p/simulations/adapters/exec.go b/p2p/simulations/adapters/exec.go
index abb196717..9b588db1b 100644
--- a/p2p/simulations/adapters/exec.go
+++ b/p2p/simulations/adapters/exec.go
@@ -46,7 +46,7 @@ import (
 
 func init() {
 	// Register a reexec function to start a simulation node when the current binary is
-	// executed as "p2p-node" (rather than whataver the main() function would normally do).
+	// executed as "p2p-node" (rather than whatever the main() function would normally do).
 	reexec.Register("p2p-node", execP2PNode)
 }
 
diff --git a/p2p/simulations/adapters/inproc.go b/p2p/simulations/adapters/inproc.go
index 52a662be6..d122cd648 100644
--- a/p2p/simulations/adapters/inproc.go
+++ b/p2p/simulations/adapters/inproc.go
@@ -130,7 +130,7 @@ func (s *SimAdapter) Dial(dest *enode.Node) (conn net.Conn, err error) {
 		return nil, err
 	}
 	// this is simulated 'listening'
-	// asynchronously call the dialed destintion node's p2p server
+	// asynchronously call the dialed destination node's p2p server
 	// to set up connection on the 'listening' side
 	go srv.SetupConn(pipe1, 0, nil)
 	return pipe2, nil
diff --git a/p2p/simulations/connect_test.go b/p2p/simulations/connect_test.go
index 36f9442a8..fd2bf5c84 100644
--- a/p2p/simulations/connect_test.go
+++ b/p2p/simulations/connect_test.go
@@ -25,6 +25,7 @@ import (
 )
 
 func newTestNetwork(t *testing.T, nodeCount int) (*Network, []enode.ID) {
+	t.Helper()
 	adapter := adapters.NewSimAdapter(adapters.Services{
 		"noopwoop": func(ctx *adapters.ServiceContext) (node.Service, error) {
 			return NewNoopService(nil), nil
diff --git a/p2p/simulations/http_test.go b/p2p/simulations/http_test.go
index d9513caaa..c0a5acb3d 100644
--- a/p2p/simulations/http_test.go
+++ b/p2p/simulations/http_test.go
@@ -35,7 +35,7 @@ import (
 	"github.com/ethereum/go-ethereum/p2p/enode"
 	"github.com/ethereum/go-ethereum/p2p/simulations/adapters"
 	"github.com/ethereum/go-ethereum/rpc"
-	colorable "github.com/mattn/go-colorable"
+	"github.com/mattn/go-colorable"
 )
 
 var (
@@ -294,6 +294,7 @@ var testServices = adapters.Services{
 }
 
 func testHTTPServer(t *testing.T) (*Network, *httptest.Server) {
+	t.Helper()
 	adapter := adapters.NewSimAdapter(testServices)
 	network := NewNetwork(adapter, &NetworkConfig{
 		DefaultService: "test",
diff --git a/p2p/simulations/mocker_test.go b/p2p/simulations/mocker_test.go
index 7c7016a5e..192be1732 100644
--- a/p2p/simulations/mocker_test.go
+++ b/p2p/simulations/mocker_test.go
@@ -15,7 +15,7 @@
 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
 
 // Package simulations simulates p2p networks.
-// A mokcer simulates starting and stopping real nodes in a network.
+// A mocker simulates starting and stopping real nodes in a network.
 package simulations
 
 import (
@@ -135,13 +135,13 @@ func TestMocker(t *testing.T) {
 	wg.Wait()
 
 	//check there are nodeCount number of nodes in the network
-	nodes_info, err := client.GetNodes()
+	nodesInfo, err := client.GetNodes()
 	if err != nil {
 		t.Fatalf("Could not get nodes list: %s", err)
 	}
 
-	if len(nodes_info) != nodeCount {
-		t.Fatalf("Expected %d number of nodes, got: %d", nodeCount, len(nodes_info))
+	if len(nodesInfo) != nodeCount {
+		t.Fatalf("Expected %d number of nodes, got: %d", nodeCount, len(nodesInfo))
 	}
 
 	//stop the mocker
@@ -160,12 +160,12 @@ func TestMocker(t *testing.T) {
 	}
 
 	//now the number of nodes in the network should be zero
-	nodes_info, err = client.GetNodes()
+	nodesInfo, err = client.GetNodes()
 	if err != nil {
 		t.Fatalf("Could not get nodes list: %s", err)
 	}
 
-	if len(nodes_info) != 0 {
-		t.Fatalf("Expected empty list of nodes, got: %d", len(nodes_info))
+	if len(nodesInfo) != 0 {
+		t.Fatalf("Expected empty list of nodes, got: %d", len(nodesInfo))
 	}
 }
diff --git a/p2p/simulations/network.go b/p2p/simulations/network.go
index a6fac2c2a..a711fd78e 100644
--- a/p2p/simulations/network.go
+++ b/p2p/simulations/network.go
@@ -518,7 +518,7 @@ func (net *Network) getConn(oneID, otherID enode.ID) *Conn {
 	return net.Conns[i]
 }
 
-// InitConn(one, other) retrieves the connectiton model for the connection between
+// InitConn(one, other) retrieves the connection model for the connection between
 // peers one and other, or creates a new one if it does not exist
 // the order of nodes does not matter, i.e., Conn(i,j) == Conn(j, i)
 // it checks if the connection is already up, and if the nodes are running
@@ -564,8 +564,8 @@ func (net *Network) Shutdown() {
 	close(net.quitc)
 }
 
-//Reset resets all network properties:
-//emtpies the nodes and the connection list
+// Reset resets all network properties:
+// empties the nodes and the connection list
 func (net *Network) Reset() {
 	net.lock.Lock()
 	defer net.lock.Unlock()
-- 
cgit v1.2.3