safe

package
v2.8.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Go

func Go(logger log.Logger, name string, fn func())

Go runs the given function in a new goroutine and recovers from panic in it. Panics are logged using the provided logger (if non-nil). If the logger is nil, the function is run without panic recovery.

func Run

func Run(logger log.Logger, name string, fn func())

Run runs the given function synchronously and recovers from panic in it. Panics are logged using the provided logger (if non-nil). If the logger is nil, the function is run without panic recovery.

func RunFunc

func RunFunc(logger log.Logger, name string, fn func() error) func() error

RunFunc returns a function wrapped with panic recovery, suitable for use in errgroup.Go. Panics are logged using the provided logger (if non-nil), and the returned function returns a non-nil error. Do not try to "unwrap" r to an error, since it is a panic and we don't want to lose the fact that it was a panic.

Types

This section is empty.

Jump to

Keyboard shortcuts

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