Help us shape the future of Go! Take the 2026 Go Developer Survey

errors

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 0 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capture

func Capture(rErr *error, fn func() error) func()

Capture is a wrapper function which can be used to capture errors from closing via a defer. An example:

func Example() (err error) {
    f, _ := os.Open(...)
    defer errors.Capture(&err, f.Close)()
    ...
    return

Doing this will result in the error from the f.Close() call being put in the error via a ptr, if the error is not nil

Types

This section is empty.

Jump to

Keyboard shortcuts

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