[lint] fix gofmt #708

pull/713/head
u5surf 6 years ago
parent bdbae9e23f
commit 4d09b63dff
  1. 4
      api/proto/node/node_test.go
  2. 6
      api/service/syncing/syncing_test.go
  3. 46
      internal/utils/configfile_test.go
  4. 12
      internal/utils/utils_test.go
  5. 8
      node/node_test.go

@ -55,8 +55,8 @@ func TestConstructTransactionListMessageAccount(t *testing.T) {
func TestConstructRequestTransactionsMessage(t *testing.T) { func TestConstructRequestTransactionsMessage(t *testing.T) {
txIDs := [][]byte{ txIDs := [][]byte{
[]byte{1, 2}, {1, 2},
[]byte{3, 4}, {3, 4},
} }
buf := ConstructRequestTransactionsMessage(txIDs) buf := ConstructRequestTransactionsMessage(txIDs)

@ -10,7 +10,7 @@ import (
// Simple test for IncorrectResponse // Simple test for IncorrectResponse
func TestCreateTestSyncPeerConfig(t *testing.T) { func TestCreateTestSyncPeerConfig(t *testing.T) {
client := &downloader.Client{} client := &downloader.Client{}
blockHashes := [][]byte{[]byte{}} blockHashes := [][]byte{{}}
syncPeerConfig := CreateTestSyncPeerConfig(client, blockHashes) syncPeerConfig := CreateTestSyncPeerConfig(client, blockHashes)
assert.Equal(t, client, syncPeerConfig.GetClient(), "error") assert.Equal(t, client, syncPeerConfig.GetClient(), "error")
} }
@ -18,9 +18,9 @@ func TestCreateTestSyncPeerConfig(t *testing.T) {
// Simple test for IncorrectResponse // Simple test for IncorrectResponse
func TestCompareSyncPeerConfigByblockHashes(t *testing.T) { func TestCompareSyncPeerConfigByblockHashes(t *testing.T) {
client := &downloader.Client{} client := &downloader.Client{}
blockHashes1 := [][]byte{[]byte{1, 2, 3}} blockHashes1 := [][]byte{{1, 2, 3}}
syncPeerConfig1 := CreateTestSyncPeerConfig(client, blockHashes1) syncPeerConfig1 := CreateTestSyncPeerConfig(client, blockHashes1)
blockHashes2 := [][]byte{[]byte{1, 2, 4}} blockHashes2 := [][]byte{{1, 2, 4}}
syncPeerConfig2 := CreateTestSyncPeerConfig(client, blockHashes2) syncPeerConfig2 := CreateTestSyncPeerConfig(client, blockHashes2)
// syncPeerConfig1 is less than syncPeerConfig2 // syncPeerConfig1 is less than syncPeerConfig2

@ -9,84 +9,84 @@ import (
func TestReadWalletProfile(t *testing.T) { func TestReadWalletProfile(t *testing.T) {
config := []*WalletProfile{ config := []*WalletProfile{
&WalletProfile{ {
Profile: "default", Profile: "default",
Bootnodes: []string{"127.0.0.1:9000/abcd", "127.0.0.1:9999/daeg"}, Bootnodes: []string{"127.0.0.1:9000/abcd", "127.0.0.1:9999/daeg"},
Shards: 4, Shards: 4,
RPCServer: [][]p2p.Peer{ RPCServer: [][]p2p.Peer{
[]p2p.Peer{ {
p2p.Peer{ {
IP: "127.0.0.4", IP: "127.0.0.4",
Port: "8888", Port: "8888",
}, },
p2p.Peer{ {
IP: "192.168.0.4", IP: "192.168.0.4",
Port: "9876", Port: "9876",
}, },
}, },
[]p2p.Peer{ {
p2p.Peer{ {
IP: "127.0.0.1", IP: "127.0.0.1",
Port: "8888", Port: "8888",
}, },
p2p.Peer{ {
IP: "192.168.0.1", IP: "192.168.0.1",
Port: "9876", Port: "9876",
}, },
}, },
[]p2p.Peer{ {
p2p.Peer{ {
IP: "127.0.0.2", IP: "127.0.0.2",
Port: "8888", Port: "8888",
}, },
p2p.Peer{ {
IP: "192.168.0.2", IP: "192.168.0.2",
Port: "9876", Port: "9876",
}, },
}, },
[]p2p.Peer{ {
p2p.Peer{ {
IP: "127.0.0.3", IP: "127.0.0.3",
Port: "8888", Port: "8888",
}, },
p2p.Peer{ {
IP: "192.168.0.3", IP: "192.168.0.3",
Port: "9876", Port: "9876",
}, },
}, },
}, },
}, },
&WalletProfile{ {
Profile: "testnet", Profile: "testnet",
Bootnodes: []string{"192.168.0.1:9990/abcd", "127.0.0.1:8888/daeg"}, Bootnodes: []string{"192.168.0.1:9990/abcd", "127.0.0.1:8888/daeg"},
Shards: 3, Shards: 3,
RPCServer: [][]p2p.Peer{ RPCServer: [][]p2p.Peer{
[]p2p.Peer{ {
p2p.Peer{ {
IP: "192.168.2.3", IP: "192.168.2.3",
Port: "8888", Port: "8888",
}, },
p2p.Peer{ {
IP: "192.168.192.3", IP: "192.168.192.3",
Port: "9877", Port: "9877",
}, },
}, },
[]p2p.Peer{ {
p2p.Peer{ {
IP: "192.168.2.1", IP: "192.168.2.1",
Port: "8888", Port: "8888",
}, },
p2p.Peer{ {
IP: "192.168.192.1", IP: "192.168.192.1",
Port: "9877", Port: "9877",
}, },
}, },
[]p2p.Peer{ {
p2p.Peer{ {
IP: "192.168.2.2", IP: "192.168.2.2",
Port: "8888", Port: "8888",
}, },
p2p.Peer{ {
IP: "192.168.192.2", IP: "192.168.192.2",
Port: "9877", Port: "9877",
}, },

@ -179,17 +179,17 @@ func TestStringsToPeers(t *testing.T) {
{ {
"127.0.0.1:9000,192.168.192.1:8888,54.32.12.3:9898", "127.0.0.1:9000,192.168.192.1:8888,54.32.12.3:9898",
[]p2p.Peer{ []p2p.Peer{
p2p.Peer{IP: "127.0.0.1", Port: "9000"}, {IP: "127.0.0.1", Port: "9000"},
p2p.Peer{IP: "192.168.192.1", Port: "8888"}, {IP: "192.168.192.1", Port: "8888"},
p2p.Peer{IP: "54.32.12.3", Port: "9898"}, {IP: "54.32.12.3", Port: "9898"},
}, },
}, },
{ {
"a:b,xx:XX,hello:world", "a:b,xx:XX,hello:world",
[]p2p.Peer{ []p2p.Peer{
p2p.Peer{IP: "a", Port: "b"}, {IP: "a", Port: "b"},
p2p.Peer{IP: "xx", Port: "XX"}, {IP: "xx", Port: "XX"},
p2p.Peer{IP: "hello", Port: "world"}, {IP: "hello", Port: "world"},
}, },
}, },
} }

@ -79,12 +79,12 @@ func TestAddPeers(t *testing.T) {
pubKey2 := pki.GetBLSPrivateKeyFromInt(444).GetPublicKey() pubKey2 := pki.GetBLSPrivateKeyFromInt(444).GetPublicKey()
peers1 := []*p2p.Peer{ peers1 := []*p2p.Peer{
&p2p.Peer{ {
IP: "127.0.0.1", IP: "127.0.0.1",
Port: "8888", Port: "8888",
ConsensusPubKey: pubKey1, ConsensusPubKey: pubKey1,
}, },
&p2p.Peer{ {
IP: "127.0.0.1", IP: "127.0.0.1",
Port: "9999", Port: "9999",
ConsensusPubKey: pubKey2, ConsensusPubKey: pubKey2,
@ -123,13 +123,13 @@ func TestAddBeaconPeer(t *testing.T) {
pubKey2 := bls2.RandPrivateKey().GetPublicKey() pubKey2 := bls2.RandPrivateKey().GetPublicKey()
peers1 := []*p2p.Peer{ peers1 := []*p2p.Peer{
&p2p.Peer{ {
IP: "127.0.0.1", IP: "127.0.0.1",
Port: "8888", Port: "8888",
ConsensusPubKey: pubKey1, ConsensusPubKey: pubKey1,
PeerID: "1234", PeerID: "1234",
}, },
&p2p.Peer{ {
IP: "127.0.0.1", IP: "127.0.0.1",
Port: "9999", Port: "9999",
ConsensusPubKey: pubKey2, ConsensusPubKey: pubKey2,

Loading…
Cancel
Save