Files
Dana Axinte b4cd51810b SecretsManager: Various utils for usage insights, outbox and secretkeeper (#106010)
* SecretsManager: utils for usage insights on ST mode

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* SecretsManager: add assert

Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>

* SecretsManager: Remove encryption scope option

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* SecretsManager: add fake keeper

Co-authored-by: Dana Axinte <53751979+dana-axinte@users.noreply.github.com>
Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>
Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

---------

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>
2025-05-28 12:46:54 +01:00

27 lines
465 B
Go

package assert
import (
"errors"
"fmt"
)
func True(expr bool, msg string, args ...any) {
if !expr {
if len(args) > 0 {
panic(fmt.Sprintf(msg, args...))
} else {
panic(msg)
}
}
}
func ErrorIs(err1, err2 error) {
if !errors.Is(err1, err2) {
panic(fmt.Sprintf("expected error %T(%+v) to be %T(%+v)", err1, err1, err2, err2))
}
}
func Equal[T comparable](v1 T, v2 T, msg string) {
True(v1 == v2, "expected %+v to equal %+v: %s", v1, v2, msg)
}