diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-29 10:20:00 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:19 +0800 |
commit | 7ece1a9f76ba17eb07c078cce6f8ffe48bac7551 (patch) | |
tree | 6f3a71a6257e23521a1ed4be3088f436b757bdb3 /dex/peer_test.go | |
parent | 3bc8c1628257b2fab50f260e048118fc56b1ab02 (diff) | |
download | go-tangerine-7ece1a9f76ba17eb07c078cce6f8ffe48bac7551.tar go-tangerine-7ece1a9f76ba17eb07c078cce6f8ffe48bac7551.tar.gz go-tangerine-7ece1a9f76ba17eb07c078cce6f8ffe48bac7551.tar.bz2 go-tangerine-7ece1a9f76ba17eb07c078cce6f8ffe48bac7551.tar.lz go-tangerine-7ece1a9f76ba17eb07c078cce6f8ffe48bac7551.tar.xz go-tangerine-7ece1a9f76ba17eb07c078cce6f8ffe48bac7551.tar.zst go-tangerine-7ece1a9f76ba17eb07c078cce6f8ffe48bac7551.zip |
Fix lint
Diffstat (limited to 'dex/peer_test.go')
-rw-r--r-- | dex/peer_test.go | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/dex/peer_test.go b/dex/peer_test.go index 6c0804498..548a61052 100644 --- a/dex/peer_test.go +++ b/dex/peer_test.go @@ -30,19 +30,19 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) { } round10 := [][]*enode.Node{ - []*enode.Node{self, nodes[1], nodes[2]}, - []*enode.Node{nodes[1], nodes[3]}, - []*enode.Node{nodes[2], nodes[4]}, + {self, nodes[1], nodes[2]}, + {nodes[1], nodes[3]}, + {nodes[2], nodes[4]}, } round11 := [][]*enode.Node{ - []*enode.Node{self, nodes[1], nodes[5]}, - []*enode.Node{nodes[5], nodes[6]}, - []*enode.Node{self, nodes[2], nodes[4]}, + {self, nodes[1], nodes[5]}, + {nodes[5], nodes[6]}, + {self, nodes[2], nodes[4]}, } round12 := [][]*enode.Node{ - []*enode.Node{self, nodes[3], nodes[5]}, - []*enode.Node{self, nodes[7], nodes[8]}, - []*enode.Node{self, nodes[2], nodes[6]}, + {self, nodes[3], nodes[5]}, + {self, nodes[7], nodes[8]}, + {self, nodes[2], nodes[6]}, } gov.notarySetFunc = func( @@ -71,11 +71,11 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) { ps.BuildNotaryConn(10) err = checkPeer2Labels(ps, map[string][]peerLabel{ - nodes[1].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 10}, + nodes[1].ID().String(): { + {notaryset, 0, 10}, }, - nodes[2].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 10}, + nodes[2].ID().String(): { + {notaryset, 0, 10}, }, }) if err != nil { @@ -103,19 +103,19 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) { ps.BuildNotaryConn(11) err = checkPeer2Labels(ps, map[string][]peerLabel{ - nodes[1].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 10}, - peerLabel{notaryset, 0, 11}, + nodes[1].ID().String(): { + {notaryset, 0, 10}, + {notaryset, 0, 11}, }, - nodes[2].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 10}, - peerLabel{notaryset, 2, 11}, + nodes[2].ID().String(): { + {notaryset, 0, 10}, + {notaryset, 2, 11}, }, - nodes[4].ID().String(): []peerLabel{ - peerLabel{notaryset, 2, 11}, + nodes[4].ID().String(): { + {notaryset, 2, 11}, }, - nodes[5].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 11}, + nodes[5].ID().String(): { + {notaryset, 0, 11}, }, }) if err != nil { @@ -144,33 +144,33 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) { ps.BuildNotaryConn(12) err = checkPeer2Labels(ps, map[string][]peerLabel{ - nodes[1].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 10}, - peerLabel{notaryset, 0, 11}, + nodes[1].ID().String(): { + {notaryset, 0, 10}, + {notaryset, 0, 11}, }, - nodes[2].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 10}, - peerLabel{notaryset, 2, 11}, - peerLabel{notaryset, 2, 12}, + nodes[2].ID().String(): { + {notaryset, 0, 10}, + {notaryset, 2, 11}, + {notaryset, 2, 12}, }, - nodes[3].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 12}, + nodes[3].ID().String(): { + {notaryset, 0, 12}, }, - nodes[4].ID().String(): []peerLabel{ - peerLabel{notaryset, 2, 11}, + nodes[4].ID().String(): { + {notaryset, 2, 11}, }, - nodes[5].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 11}, - peerLabel{notaryset, 0, 12}, + nodes[5].ID().String(): { + {notaryset, 0, 11}, + {notaryset, 0, 12}, }, - nodes[6].ID().String(): []peerLabel{ - peerLabel{notaryset, 2, 12}, + nodes[6].ID().String(): { + {notaryset, 2, 12}, }, - nodes[7].ID().String(): []peerLabel{ - peerLabel{notaryset, 1, 12}, + nodes[7].ID().String(): { + {notaryset, 1, 12}, }, - nodes[8].ID().String(): []peerLabel{ - peerLabel{notaryset, 1, 12}, + nodes[8].ID().String(): { + {notaryset, 1, 12}, }, }) if err != nil { @@ -200,23 +200,23 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) { ps.ForgetNotaryConn(11) err = checkPeer2Labels(ps, map[string][]peerLabel{ - nodes[2].ID().String(): []peerLabel{ - peerLabel{notaryset, 2, 12}, + nodes[2].ID().String(): { + {notaryset, 2, 12}, }, - nodes[3].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 12}, + nodes[3].ID().String(): { + {notaryset, 0, 12}, }, - nodes[5].ID().String(): []peerLabel{ - peerLabel{notaryset, 0, 12}, + nodes[5].ID().String(): { + {notaryset, 0, 12}, }, - nodes[6].ID().String(): []peerLabel{ - peerLabel{notaryset, 2, 12}, + nodes[6].ID().String(): { + {notaryset, 2, 12}, }, - nodes[7].ID().String(): []peerLabel{ - peerLabel{notaryset, 1, 12}, + nodes[7].ID().String(): { + {notaryset, 1, 12}, }, - nodes[8].ID().String(): []peerLabel{ - peerLabel{notaryset, 1, 12}, + nodes[8].ID().String(): { + {notaryset, 1, 12}, }, }) if err != nil { @@ -277,9 +277,9 @@ func TestPeerSetBuildDKGConn(t *testing.T) { gov.dkgSetFunc = func(round uint64) (map[string]struct{}, error) { m := map[uint64][]*enode.Node{ - 10: []*enode.Node{self, nodes[1], nodes[2]}, - 11: []*enode.Node{nodes[1], nodes[2], nodes[5]}, - 12: []*enode.Node{self, nodes[3], nodes[5]}, + 10: {self, nodes[1], nodes[2]}, + 11: {nodes[1], nodes[2], nodes[5]}, + 12: {self, nodes[3], nodes[5]}, } return newTestNodeSet(m[round]), nil } @@ -300,11 +300,11 @@ func TestPeerSetBuildDKGConn(t *testing.T) { ps.BuildDKGConn(10) err = checkPeer2Labels(ps, map[string][]peerLabel{ - nodes[1].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 10}, + nodes[1].ID().String(): { + {dkgset, 0, 10}, }, - nodes[2].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 10}, + nodes[2].ID().String(): { + {dkgset, 0, 10}, }, }) if err != nil { @@ -325,11 +325,11 @@ func TestPeerSetBuildDKGConn(t *testing.T) { ps.BuildDKGConn(11) err = checkPeer2Labels(ps, map[string][]peerLabel{ - nodes[1].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 10}, + nodes[1].ID().String(): { + {dkgset, 0, 10}, }, - nodes[2].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 10}, + nodes[2].ID().String(): { + {dkgset, 0, 10}, }, }) if err != nil { @@ -350,17 +350,17 @@ func TestPeerSetBuildDKGConn(t *testing.T) { ps.BuildDKGConn(12) err = checkPeer2Labels(ps, map[string][]peerLabel{ - nodes[1].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 10}, + nodes[1].ID().String(): { + {dkgset, 0, 10}, }, - nodes[2].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 10}, + nodes[2].ID().String(): { + {dkgset, 0, 10}, }, - nodes[3].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 12}, + nodes[3].ID().String(): { + {dkgset, 0, 12}, }, - nodes[5].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 12}, + nodes[5].ID().String(): { + {dkgset, 0, 12}, }, }) if err != nil { @@ -381,11 +381,11 @@ func TestPeerSetBuildDKGConn(t *testing.T) { ps.ForgetDKGConn(11) err = checkPeer2Labels(ps, map[string][]peerLabel{ - nodes[3].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 12}, + nodes[3].ID().String(): { + {dkgset, 0, 12}, }, - nodes[5].ID().String(): []peerLabel{ - peerLabel{dkgset, 0, 12}, + nodes[5].ID().String(): { + {dkgset, 0, 12}, }, }) if err != nil { @@ -438,7 +438,7 @@ func checkPeer2Labels(ps *peerSet, want map[string][]peerLabel) error { for _, label := range wantLabels { if _, ok := gotLabels[label]; !ok { - fmt.Errorf("label: %+v not exists", label) + return fmt.Errorf("label: %+v not exists", label) } } } |