must

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package must provides helper functions that panic on error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeTrue added in v1.0.0

func BeTrue(b bool)

BeTrue panic if the b is not true.

Use that function only for static initialization, test code, or statemants that "can't" be false. When in doubt, don't.

func BeZero added in v1.20.0

func BeZero[T comparable](v T)

BeZero panics if argument has non-zero value.

Use that function only for static initialization, test code, or code that "can't" fail. When in doubt, don't.

func NoError added in v0.1.1

func NoError(err error)

NoError panics if the error is not nil.

Use that function only for static initialization, test code, or code that "can't" fail. When in doubt, don't.

func NotBeZero added in v1.1.0

func NotBeZero[T comparable](v T)

NotBeZero panics if argument has zero value.

Use that function only for static initialization, test code, or code that "can't" fail. When in doubt, don't.

func NotFail

func NotFail[T any](res T, err error) T

NotFail panics if the error is not nil, returns res otherwise.

Use that function only for static initialization, test code, or code that "can't" fail. When in doubt, don't.

Types

This section is empty.

Jump to

Keyboard shortcuts

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