must

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package must turns an error that cannot happen into a panic, so that a caller does not carry a branch no test can reach. Use it only for work that cannot fail with the inputs the program itself chose: generating a key from the system's random source, signing with a key just made, parsing a certificate just built. Never use it for anything that depends on a person, a file, the network or a database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(err error)

Do panics when err is not nil.

func Value

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

Value returns v, and panics when err is not nil.

func Value2

func Value2[A, B any](a A, b B, err error) (A, B)

Value2 returns a and b, and panics when err 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