errdefer

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package errdefer provides functions that call arbitrary functions if there is an error on function exit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close[F CloseFunc](err *error, closeFn F) error

Close calls fn when *err is not nil. Returns an error returned from fn.

func CloseContext

func CloseContext[F CloseContextFunc](ctx context.Context, err *error, closeFn F) error

CloseContext calls fn with provided Context when *err is not nil. Returns an error returned from fn.

Types

type CloseContextFunc

type CloseContextFunc interface {
	~func(context.Context) | ~func(context.Context) error
}

type CloseFunc

type CloseFunc interface {
	~func() | ~func() error | ~func(context.Context) | ~func(context.Context) error
}

Jump to

Keyboard shortcuts

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