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

+1 -1
View File
@@ -169,7 +169,7 @@ func (peers *Peers) garbageCollect() []*Peer {
func setFromPeersMap(peers map[PeerName]*Peer) PeerNameSet {
names := make(PeerNameSet)
for name := range peers {
names[name] = true
names[name] = struct{}{}
}
return names
}