server with basic hot reload
This commit is contained in:
16
internal/safe/recover.go
Normal file
16
internal/safe/recover.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package safe
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func SafeGO(fn func(), errs chan<- error) {
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
errs <- fmt.Errorf("panic: %v", r)
|
||||
}
|
||||
}()
|
||||
fn()
|
||||
}()
|
||||
}
|
||||
Reference in New Issue
Block a user