safego

package
v0.0.0-...-849f898 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package safego wraps "go" call with additional recover feature to keep your goroutine away from panic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Go

func Go(f func(), handlers ...RecoverHandler)

Go run the f() with a goroutine and keep it away from panic it will use defaultRecoverHandler if argument handler is nil

func GoWith

func GoWith(f func(args ...interface{}), handlers ...RecoverHandler) func(args ...interface{})

GoWith run the f(...interface{}) with a goroutine and keep it away from panic eg.

GoWith(func(args ...interface{}) { }, func(err interface{}) { })(1, 0)

Types

type RecoverHandler

type RecoverHandler func(err interface{})

RecoverHandler when panic happen, the hander will be called

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL