diff options
Diffstat (limited to 'node')
-rw-r--r-- | node/api.go | 2 | ||||
-rw-r--r-- | node/config_test.go | 2 | ||||
-rw-r--r-- | node/node_example_test.go | 2 | ||||
-rw-r--r-- | node/node_test.go | 16 |
4 files changed, 11 insertions, 11 deletions
diff --git a/node/api.go b/node/api.go index 988eff379..3c451fc8a 100644 --- a/node/api.go +++ b/node/api.go @@ -104,7 +104,7 @@ func (api *PrivateAdminAPI) StartRPC(host *string, port *int, cors *string, apis } } - if err := api.node.startHTTP(fmt.Sprintf("%s:%d", *host, port), api.node.rpcAPIs, modules, *cors); err != nil { + if err := api.node.startHTTP(fmt.Sprintf("%s:%d", *host, *port), api.node.rpcAPIs, modules, *cors); err != nil { return false, err } return true, nil diff --git a/node/config_test.go b/node/config_test.go index b258d2a8b..d18732fdb 100644 --- a/node/config_test.go +++ b/node/config_test.go @@ -137,7 +137,7 @@ func TestNodeKeyPersistency(t *testing.T) { if err != nil { t.Fatalf("failed to read previously persisted node key: %v", err) } - if bytes.Compare(blob1, blob2) != 0 { + if !bytes.Equal(blob1, blob2) { t.Fatalf("persisted node key mismatch: have %x, want %x", blob2, blob1) } diff --git a/node/node_example_test.go b/node/node_example_test.go index 01ff683c0..7c586452f 100644 --- a/node/node_example_test.go +++ b/node/node_example_test.go @@ -44,7 +44,7 @@ func (s *SampleService) Stop() error { fmt.Println("Service stoppi func ExampleUsage() { // Create a network node to run protocols with the default values. The below list // is only used to display each of the configuration options. All of these could - // have been ommited if the default behavior is desired. + // have been omitted if the default behavior is desired. nodeConfig := &node.Config{ DataDir: "", // Empty uses ephemeral storage PrivateKey: nil, // Nil generates a node key on the fly diff --git a/node/node_test.go b/node/node_test.go index d9b26453b..408d4cfcb 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -166,7 +166,7 @@ func TestServiceLifeCycle(t *testing.T) { if err := stack.Start(); err != nil { t.Fatalf("failed to start protocol stack: %v", err) } - for id, _ := range services { + for id := range services { if !started[id] { t.Fatalf("service %s: freshly started service not running", id) } @@ -178,7 +178,7 @@ func TestServiceLifeCycle(t *testing.T) { if err := stack.Stop(); err != nil { t.Fatalf("failed to stop protocol stack: %v", err) } - for id, _ := range services { + for id := range services { if !stopped[id] { t.Fatalf("service %s: freshly terminated service still running", id) } @@ -218,7 +218,7 @@ func TestServiceRestarts(t *testing.T) { } defer stack.Stop() - if running != true || started != 1 { + if !running || started != 1 { t.Fatalf("running/started mismatch: have %v/%d, want true/1", running, started) } // Restart the stack a few times and check successful service restarts @@ -227,7 +227,7 @@ func TestServiceRestarts(t *testing.T) { t.Fatalf("iter %d: failed to restart stack: %v", i, err) } } - if running != true || started != 4 { + if !running || started != 4 { t.Fatalf("running/started mismatch: have %v/%d, want true/4", running, started) } } @@ -270,7 +270,7 @@ func TestServiceConstructionAbortion(t *testing.T) { if err := stack.Start(); err != failure { t.Fatalf("iter %d: stack startup failure mismatch: have %v, want %v", i, err, failure) } - for id, _ := range services { + for id := range services { if started[id] { t.Fatalf("service %s: started should not have", id) } @@ -322,7 +322,7 @@ func TestServiceStartupAbortion(t *testing.T) { if err := stack.Start(); err != failure { t.Fatalf("iter %d: stack startup failure mismatch: have %v, want %v", i, err, failure) } - for id, _ := range services { + for id := range services { if started[id] && !stopped[id] { t.Fatalf("service %s: started but not stopped", id) } @@ -376,7 +376,7 @@ func TestServiceTerminationGuarantee(t *testing.T) { if err := stack.Start(); err != nil { t.Fatalf("iter %d: failed to start protocol stack: %v", i, err) } - for id, _ := range services { + for id := range services { if !started[id] { t.Fatalf("iter %d, service %s: service not running", i, id) } @@ -397,7 +397,7 @@ func TestServiceTerminationGuarantee(t *testing.T) { t.Fatalf("iter %d: failure count mismatch: have %d, want %d", i, len(err.Services), 1) } } - for id, _ := range services { + for id := range services { if !stopped[id] { t.Fatalf("iter %d, service %s: service not terminated", i, id) } |