panicguard

package
v1.138.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package panicguard runs background work in a goroutine with a recovery frame.

The gRPC recovery middleware only wraps the request handler's own stack. A goroutine spawned from a handler escapes it, so an unrecovered panic there terminates the whole process. Any request-spawned goroutine must therefore run through this package instead of a bare `go`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Go

func Go(logger *log.Helper, task string, fn func())

Go runs fn in a new goroutine with a recovery frame. A recovered panic is logged with its stack and swallowed so it cannot crash the process.

func Recover

func Recover(logger *log.Helper, task string, fn func())

Recover runs fn in the current goroutine with a recovery frame. It is the synchronous core of Go, exposed for callers that already own a goroutine and for tests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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