must

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package must contains generic functions for ensuring a function is called that returns a nil error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compute

func Compute[T any](fn func() (T, error)) T

Compute returns fn()'s first return value and panics if err is non-nil.

func Do

func Do(fn func() error)

Do panics if calling the function results in an error.

func Value

func Value[T any](t T, err error) T

Value returns the first value if the err is non-nil; otherwise, it panics.

Types

This section is empty.

Jump to

Keyboard shortcuts

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