From 4490c3ed1a706b1d222ecc4ece312a0bef5d8850 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Mon, 22 May 2017 11:51:38 -0400 Subject: [PATCH] resources: Map to semaphores doesn't need to be a pointer A map in golang is a reference type. --- pgraph/semaphore.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pgraph/semaphore.go b/pgraph/semaphore.go index b6ac7680..d2f703d8 100644 --- a/pgraph/semaphore.go +++ b/pgraph/semaphore.go @@ -108,17 +108,17 @@ func SemaLockFromGraph(g *Graph) *sync.Mutex { // SemaMapFromGraph returns a pointer to the map of semaphores stored with the // graph, otherwise it panics. If one does not exist, it will create it. -func SemaMapFromGraph(g *Graph) *map[string]*semaphore.Semaphore { +func SemaMapFromGraph(g *pgraph.Graph) map[string]*semaphore.Semaphore { x, exists := g.Value("semas") if !exists { semas := make(map[string]*semaphore.Semaphore) - g.SetValue("semas", &semas) + g.SetValue("semas", semas) x, _ = g.Value("semas") } - semas, ok := x.(*map[string]*semaphore.Semaphore) + semas, ok := x.(map[string]*semaphore.Semaphore) if !ok { - panic("not a *map[string]*semaphore.Semaphore") + panic("not a map[string]*semaphore.Semaphore") } return semas }