softassert

package
v1.29.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail

func Fail(logger log.Logger, msg string)

Fail logs an error message indicating a failed assertion. It works the same as That, but does not require a condition.

func That

func That(logger log.Logger, condition bool, msg string) bool

That performs a soft assertion by logging an error if the given condition is false. It is meant to indicate a condition that are always expected to be true. Returns true if the condition is met, otherwise false.

Example: softassert.That(logger, object.state == "ready", "object is not ready")

Best practices: - Use it to check for programming errors and invariants. - Use it to communicate assumptions about the code. - Use it to abort or recover from an unexpected state. - Never use it as a substitute for regular error handling, validation, or control flow.

Types

This section is empty.

Jump to

Keyboard shortcuts

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