Documentation
¶
Overview ¶
Package panics implements some helper methods around panicing
While you should handle and return errors instead of throwing a panic (https://blog.golang.org/error-handling-and-go), there are times where having a runtime assertion is useful.
Index ¶
- func If(condition bool, msgAndArgs ...interface{})
- func IfEqual(expected, actual interface{}, msgAndArgs ...interface{})
- func IfError(err error, msgAndArgs ...interface{})
- func IfNil(v interface{}, msgAndArgs ...interface{})
- func IfNot(condition bool, msgAndArgs ...interface{})
- func IfNotEqual(expected, actual interface{}, msgAndArgs ...interface{})
- func IfNotError(err error, msgAndArgs ...interface{})
- func IfNotNil(v interface{}, msgAndArgs ...interface{})
- func Now(msgAndArgs ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func If ¶
func If(condition bool, msgAndArgs ...interface{})
If will trigger a panic only if the condition is true
func IfEqual ¶
func IfEqual(expected, actual interface{}, msgAndArgs ...interface{})
IfEqual will trigger a panic only if the expected and actual are equal
func IfError ¶
func IfError(err error, msgAndArgs ...interface{})
IfError will trigger a panic only if the error is not nil
func IfNil ¶
func IfNil(v interface{}, msgAndArgs ...interface{})
IfNil will trigger a panic only if the value is nil
func IfNot ¶
func IfNot(condition bool, msgAndArgs ...interface{})
IfNot will trigger a panic only if the condition is false
func IfNotEqual ¶
func IfNotEqual(expected, actual interface{}, msgAndArgs ...interface{})
IfNotEqual will trigger a panic only if the expected and actual are not equal
func IfNotError ¶
func IfNotError(err error, msgAndArgs ...interface{})
IfNotError will trigger a panic only if the error is nil
Types ¶
This section is empty.