runsafe

package
Version: v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package runsafe contains things that leverage the unsafe builtin package. Its contents should be treated as experimental and unstable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoverCtx

func RecoverCtx() (context.Context, error)

RecoverCtx returns (from the bottom up) the first context that's encountered in the callstack it stops the current goroutine to build a stacktrace, walks up the stack to find contexts, and returns the first one if no context is encountered, an empty context and an UnrecoverableContext Error are returned this is not guaranteed to work: many things can go wrong, chief among them is that inlined functions elide their parameter memory addresses see https://dave.cheney.net/2019/12/08/dynamically-scoped-variables-in-go for a more thorough explanation on how this works

Types

type UnrecoverableContext

type UnrecoverableContext struct{}

UnrecoverableContext is an error indicating that the context could not be dynamically recovered

func (UnrecoverableContext) Error

func (UnrecoverableContext) Error() string

Source Files

Jump to

Keyboard shortcuts

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