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
Этот коммит содержится в:
Chris
2017-10-04 13:09:41 -07:00
коммит произвёл GitHub
родитель dc9b1a1d6a
Коммит 07777f5ff9
23 изменённых файлов: 139 добавлений и 67 удалений

Просмотреть файл

@@ -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 {