From a9158c3a0c05fe635d52453452c22d53c18c9c20 Mon Sep 17 00:00:00 2001 From: mappu Date: Tue, 16 May 2017 19:47:50 +1200 Subject: [PATCH] gms: fix missing initialisation --- MemoryStore.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/MemoryStore.go b/MemoryStore.go index b508229..bec7f12 100644 --- a/MemoryStore.go +++ b/MemoryStore.go @@ -18,6 +18,12 @@ type GoMemoryStore struct { next int64 } +func NewGoMemoryStore() *GoMemoryStore { + ret := GoMemoryStore{} + ret.items = make(map[int64]interface{}) + return &ret +} + func (this *GoMemoryStore) Put(itm interface{}) ObjectReference { this.mtx.Lock() defer this.mtx.Unlock() @@ -43,4 +49,4 @@ func (this *GoMemoryStore) Delete(i ObjectReference) { delete(this.items, int64(i)) } -var gms GoMemoryStore +var gms = NewGoMemoryStore()