From a9c44e0b85293d6571d27548a07d9cde05f8e06d Mon Sep 17 00:00:00 2001 From: lash Date: Tue, 19 Mar 2019 16:26:36 +0100 Subject: [PATCH] swarm/network: Simplify bucket instantiation in servicectx func --- swarm/network/simulation/simulation.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/swarm/network/simulation/simulation.go b/swarm/network/simulation/simulation.go index 788442a3ce..722a01bdc5 100644 --- a/swarm/network/simulation/simulation.go +++ b/swarm/network/simulation/simulation.go @@ -85,9 +85,8 @@ func New(services map[string]ServiceFunc) (s *Simulation) { name, serviceFunc := name, serviceFunc s.serviceNames = append(s.serviceNames, name) adapterServices[name] = func(ctx *adapters.ServiceContext) (node.Service, error) { - var b *sync.Map - var ok bool - if b, ok = s.buckets[ctx.Config.ID]; !ok { + b, ok := s.buckets[ctx.Config.ID] + if !ok { b = new(sync.Map) } service, cleanup, err := serviceFunc(ctx, b)