uerror

package
v1.17.15 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must

func Must(args ...any)

Must takes a variadic number of interface{} arguments and panics if the last argument is a non-nil error. This allows Must function to handle functions returning multiple values, where the last value is an error.

Examples:

  • With a function returning only an error: Must(doSomethingRisky())

  • With a function returning a result and an error: data, err := os.ReadFile("./myfile.txt") Must(data, err) // Panics if err is non-nil

  • Direct usage with a function that returns an error: Must(os.Remove("./myfile.txt")) // Panics if Remove returns an error

Types

This section is empty.

Jump to

Keyboard shortcuts

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