mirror of
https://github.com/bloeys/nterm.git
synced 2025-12-29 14:38:19 +00:00
16 lines
394 B
Go
Executable File
16 lines
394 B
Go
Executable File
package assert
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/bloeys/nterm/consts"
|
|
)
|
|
|
|
func T(check bool, msg string, args ...any) {
|
|
if consts.Mode_Debug && !check {
|
|
// Sprintf is done inside the assert because putting it as the argument to 'msg' blocks
|
|
// the function from getting fully optimized out on a release build (and slower in general)
|
|
panic("Assert failed: " + fmt.Sprintf(msg, args...))
|
|
}
|
|
}
|