helper

package
v0.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNil

func MustNil(err error)

MustNil panics if err is not nil. MustNil is a defensive assertion used primarily in security-sensitive areas. It ensures that an error, which "should never" occur, is truly absent. This acts as a safeguard against future changes in upstream APIs.

This is intended to be used with crypto/rand.Read. As noted in the documentation for crypto/rand.Read, it does not return a non-nil error. While we believe this interface will never change, we include this check just to be absolutely sure — for security reasons.

Example:

buf := make([]byte, 10)
_, err := rand.Read(buf) // Never returns a non-nil error.
internal.MustNil(err)    // But we check anyway, just in case.

Types

This section is empty.

Jump to

Keyboard shortcuts

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