use map[...]struct{} for sets instead of map[...]bool

See https://groups.google.com/d/msg/golang-nuts/lb4xLHq7wug/MhrSLkyS4F8J

We don't really care about the performance aspect of this, but using
struct{}{} values is in some way canonical since it means the
representation carries no redundant information.
This commit is contained in:
Matthias Radestock committed 2015-04-06 11:35:11 +01:00
1 parent 6f2f25aca5
commit 74b3f8d44e
4 files changed
+25 -21

No files matched your search

+2 -2
View File
@@ -48,9 +48,9 @@ func newMockConnection(from, to *Peer) Connection {
}
func checkEqualConns(t *testing.T, ourName PeerName, got, wanted map[PeerName]Connection) {
checkConns := make(map[PeerName]bool)
checkConns := make(map[PeerName]struct{})
for _, conn := range wanted {
checkConns[conn.Remote().Name] = true
checkConns[conn.Remote().Name] = struct{}{}
}
for _, conn := range got {
remoteName := conn.Remote().Name