doa

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 1 Imported by: 5

README

Doa

Package doa is the abbreviation of the "Dead or alive". It provides some easy ways to make you panic down the program.

One of the benefits of detecting problems as soon as you can is that you can crash earlier, and crashing is often the bet thing you can do. The alternative may be to continue, writing corrupted data to some vital database or commanding the washing machine into its twentieth consecutive spin cycle.

Crash is not poison, it's "Quit gracefully".

Documentation

Overview

Package doa stands for "dead or alive". It provides simple utilities to intentionally crash the program with a panic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Doa

func Doa(b bool)

Doa checks a boolean condition and triggers a panic if it’s false.

func Err

func Err(a any, err error) error

Err returns the error passed to it, ignoring the first argument.

func Nil

func Nil(err error)

Nil checks if an error is non-nil and panics if it is.

func Try

func Try[T any](a T, err error) T

Try returns a value if there’s no error, otherwise it panics.

func Val

func Val[T any](a T, err error) T

Val returns the first argument, ignoring the error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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