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:
1 parent
6f2f25aca5
commit
74b3f8d44e
4 files changed
+25
-21
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user