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.
Click to show internal directories.
Click to hide internal directories.