Initial QSfera import

This commit is contained in:
Курнат Андрей
2026-06-07 10:20:04 +03:00
commit 2315f25754
16485 changed files with 4826827 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package syncs
import "fmt"
// Go is a basic promise implementation: it wraps calls a function in a goroutine
// and returns a channel which will later return the function's return value.
//
// if panic happen, it will be recovered and return as error
func Go(f func() error) error {
ch := make(chan error)
go func() {
// add recovery handle
defer func() {
if r := recover(); r != nil {
ch <- fmt.Errorf("panic recover: %v", r)
}
}()
ch <- f()
}()
return <-ch
}