diff options
author | Felix Lange <fjl@twurst.com> | 2017-01-06 22:52:03 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-01-06 22:52:03 +0800 |
commit | 35a7dcb162546f7f31cb6492f716cb93159218d7 (patch) | |
tree | 4828026948031719a703a87e0ce909e82da21d3b /whisper | |
parent | e0fde022909d272e55fb9ea2d4f8cfe9f178dba8 (diff) | |
download | go-tangerine-35a7dcb162546f7f31cb6492f716cb93159218d7.tar go-tangerine-35a7dcb162546f7f31cb6492f716cb93159218d7.tar.gz go-tangerine-35a7dcb162546f7f31cb6492f716cb93159218d7.tar.bz2 go-tangerine-35a7dcb162546f7f31cb6492f716cb93159218d7.tar.lz go-tangerine-35a7dcb162546f7f31cb6492f716cb93159218d7.tar.xz go-tangerine-35a7dcb162546f7f31cb6492f716cb93159218d7.tar.zst go-tangerine-35a7dcb162546f7f31cb6492f716cb93159218d7.zip |
all: gofmt -w -s
Diffstat (limited to 'whisper')
-rw-r--r-- | whisper/whisperv2/filter.go | 2 | ||||
-rw-r--r-- | whisper/whisperv2/peer.go | 2 | ||||
-rw-r--r-- | whisper/whisperv2/peer_test.go | 2 | ||||
-rw-r--r-- | whisper/whisperv2/topic_test.go | 52 | ||||
-rw-r--r-- | whisper/whisperv5/peer.go | 2 | ||||
-rw-r--r-- | whisper/whisperv5/whisper.go | 2 |
6 files changed, 31 insertions, 31 deletions
diff --git a/whisper/whisperv2/filter.go b/whisper/whisperv2/filter.go index 8ce4a54fb..ed7dcd6ae 100644 --- a/whisper/whisperv2/filter.go +++ b/whisper/whisperv2/filter.go @@ -116,7 +116,7 @@ func (self filterer) Compare(f filter.Filter) bool { topics := make([]Topic, len(filter.matcher.conditions)) for i, group := range filter.matcher.conditions { // Message should contain a single topic entry, extract - for topics[i], _ = range group { + for topics[i] = range group { break } } diff --git a/whisper/whisperv2/peer.go b/whisper/whisperv2/peer.go index 404ebd513..f09ce3523 100644 --- a/whisper/whisperv2/peer.go +++ b/whisper/whisperv2/peer.go @@ -149,7 +149,7 @@ func (self *peer) expire() { return true }) // Dump all known but unavailable - for hash, _ := range unmark { + for hash := range unmark { self.known.Remove(hash) } } diff --git a/whisper/whisperv2/peer_test.go b/whisper/whisperv2/peer_test.go index 9755e134c..87ca5063d 100644 --- a/whisper/whisperv2/peer_test.go +++ b/whisper/whisperv2/peer_test.go @@ -221,7 +221,7 @@ func TestPeerMessageExpiration(t *testing.T) { t.Fatalf("peer pool size mismatch: have %v, want %v", peers, 1) } var peer *peer - for peer, _ = range tester.client.peers { + for peer = range tester.client.peers { break } tester.client.peerMu.RUnlock() diff --git a/whisper/whisperv2/topic_test.go b/whisper/whisperv2/topic_test.go index efd4a2c61..66c84ba35 100644 --- a/whisper/whisperv2/topic_test.go +++ b/whisper/whisperv2/topic_test.go @@ -73,30 +73,30 @@ var topicMatcherCreationTest = struct { matcher []map[[4]byte]struct{} }{ binary: [][][]byte{ - [][]byte{}, - [][]byte{ + {}, + { []byte("Topic A"), }, - [][]byte{ + { []byte("Topic B1"), []byte("Topic B2"), []byte("Topic B3"), }, }, textual: [][]string{ - []string{}, - []string{"Topic A"}, - []string{"Topic B1", "Topic B2", "Topic B3"}, + {}, + {"Topic A"}, + {"Topic B1", "Topic B2", "Topic B3"}, }, matcher: []map[[4]byte]struct{}{ - map[[4]byte]struct{}{}, - map[[4]byte]struct{}{ - [4]byte{0x25, 0xfc, 0x95, 0x66}: struct{}{}, + {}, + { + {0x25, 0xfc, 0x95, 0x66}: {}, }, - map[[4]byte]struct{}{ - [4]byte{0x93, 0x6d, 0xec, 0x09}: struct{}{}, - [4]byte{0x25, 0x23, 0x34, 0xd3}: struct{}{}, - [4]byte{0x6b, 0xc2, 0x73, 0xd1}: struct{}{}, + { + {0x93, 0x6d, 0xec, 0x09}: {}, + {0x25, 0x23, 0x34, 0xd3}: {}, + {0x6b, 0xc2, 0x73, 0xd1}: {}, }, }, } @@ -106,14 +106,14 @@ func TestTopicMatcherCreation(t *testing.T) { matcher := newTopicMatcherFromBinary(test.binary...) for i, cond := range matcher.conditions { - for topic, _ := range cond { + for topic := range cond { if _, ok := test.matcher[i][topic]; !ok { t.Errorf("condition %d; extra topic found: 0x%x", i, topic[:]) } } } for i, cond := range test.matcher { - for topic, _ := range cond { + for topic := range cond { if _, ok := matcher.conditions[i][topic]; !ok { t.Errorf("condition %d; topic not found: 0x%x", i, topic[:]) } @@ -122,14 +122,14 @@ func TestTopicMatcherCreation(t *testing.T) { matcher = newTopicMatcherFromStrings(test.textual...) for i, cond := range matcher.conditions { - for topic, _ := range cond { + for topic := range cond { if _, ok := test.matcher[i][topic]; !ok { t.Errorf("condition %d; extra topic found: 0x%x", i, topic[:]) } } } for i, cond := range test.matcher { - for topic, _ := range cond { + for topic := range cond { if _, ok := matcher.conditions[i][topic]; !ok { t.Errorf("condition %d; topic not found: 0x%x", i, topic[:]) } @@ -155,49 +155,49 @@ var topicMatcherTests = []struct { }, // Fixed topic matcher should match strictly, but only prefix { - filter: [][]string{[]string{"a"}, []string{"b"}}, + filter: [][]string{{"a"}, {"b"}}, topics: []string{"a"}, match: false, }, { - filter: [][]string{[]string{"a"}, []string{"b"}}, + filter: [][]string{{"a"}, {"b"}}, topics: []string{"a", "b"}, match: true, }, { - filter: [][]string{[]string{"a"}, []string{"b"}}, + filter: [][]string{{"a"}, {"b"}}, topics: []string{"a", "b", "c"}, match: true, }, // Multi-matcher should match any from a sub-group { - filter: [][]string{[]string{"a1", "a2"}}, + filter: [][]string{{"a1", "a2"}}, topics: []string{"a"}, match: false, }, { - filter: [][]string{[]string{"a1", "a2"}}, + filter: [][]string{{"a1", "a2"}}, topics: []string{"a1"}, match: true, }, { - filter: [][]string{[]string{"a1", "a2"}}, + filter: [][]string{{"a1", "a2"}}, topics: []string{"a2"}, match: true, }, // Wild-card condition should match anything { - filter: [][]string{[]string{}, []string{"b"}}, + filter: [][]string{{}, {"b"}}, topics: []string{"a"}, match: false, }, { - filter: [][]string{[]string{}, []string{"b"}}, + filter: [][]string{{}, {"b"}}, topics: []string{"a", "b"}, match: true, }, { - filter: [][]string{[]string{}, []string{"b"}}, + filter: [][]string{{}, {"b"}}, topics: []string{"b", "b"}, match: true, }, diff --git a/whisper/whisperv5/peer.go b/whisper/whisperv5/peer.go index 4273cfce1..634045504 100644 --- a/whisper/whisperv5/peer.go +++ b/whisper/whisperv5/peer.go @@ -148,7 +148,7 @@ func (peer *Peer) expire() { return true }) // Dump all known but unavailable - for hash, _ := range unmark { + for hash := range unmark { peer.known.Remove(hash) } } diff --git a/whisper/whisperv5/whisper.go b/whisper/whisperv5/whisper.go index 789adbdb3..b514c022e 100644 --- a/whisper/whisperv5/whisper.go +++ b/whisper/whisperv5/whisper.go @@ -105,7 +105,7 @@ func (w *Whisper) Version() uint { func (w *Whisper) getPeer(peerID []byte) (*Peer, error) { w.peerMu.Lock() defer w.peerMu.Unlock() - for p, _ := range w.peers { + for p := range w.peers { id := p.peer.ID() if bytes.Equal(peerID, id[:]) { return p, nil |