From 07777f5ff9e0bde26abd0288164e5f73b6da992a Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 4 Oct 2017 13:09:41 -0700 Subject: Fix races / finally remove global app for good (#7570) * finally remove global app for good * test compilation fixes * fix races * fix deadlock * wake up write pump so it doesn't take forever to clean up --- store/store.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'store/store.go') diff --git a/store/store.go b/store/store.go index bc9aa8f1a..120778e84 100644 --- a/store/store.go +++ b/store/store.go @@ -18,6 +18,17 @@ type StoreResult struct { type StoreChannel chan StoreResult +func Do(f func(result *StoreResult)) StoreChannel { + storeChannel := make(StoreChannel, 1) + go func() { + result := StoreResult{} + f(&result) + storeChannel <- result + close(storeChannel) + }() + return storeChannel +} + func Must(sc StoreChannel) interface{} { r := <-sc if r.Err != nil { -- cgit v1.2.3-1-g7c22