must

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 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

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

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

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

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