go.astrophena.name/base Module
Base Go packages for my projects.
package unwrap
import "go.astrophena.name/base/unwrap"
Package unwrap provides helper functions to panic on non-nil errors.
This package is intended for use in initialization or test code where an error is considered a fatal, unrecoverable condition. It should be used sparingly in application logic where idiomatic error handling is preferred.
Index
Functions
func NoError
func NoError(err error)
NoError panics if err is not nil. It is used for checking operations that don't return a value.
func Value
func Value[T any](val T, err error) T
Value unwraps and returns val if err is nil. It panics if err is not nil.