Convert bool map to struct{} map in etcd.go (#2381)

This fix converts bool map to struct{} map in etcd.go
(there might be several other places).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2018-12-08 06:15:11 -08:00
committed by GitHub
parent f02da83e9c
commit 0f7d95b1e7

View File

@@ -118,7 +118,7 @@ func (e *Etcd) get(path string, recursive bool) (*etcdcv3.GetResponse, error) {
} }
func (e *Etcd) loopNodes(kv []*mvccpb.KeyValue, nameParts []string, star bool) (sx []msg.Service, err error) { func (e *Etcd) loopNodes(kv []*mvccpb.KeyValue, nameParts []string, star bool) (sx []msg.Service, err error) {
bx := make(map[msg.Service]bool) bx := make(map[msg.Service]struct{})
Nodes: Nodes:
for _, n := range kv { for _, n := range kv {
if star { if star {
@@ -145,7 +145,7 @@ Nodes:
if _, ok := bx[b]; ok { if _, ok := bx[b]; ok {
continue continue
} }
bx[b] = true bx[b] = struct{}{}
serv.Key = string(n.Key) serv.Key = string(n.Key)
serv.TTL = e.TTL(n, serv) serv.TTL = e.TTL(n, serv)