Detect lines as they come in+sprintf in assert so it gets optimized away on release mode :)

This commit is contained in:
bloeys
2022-07-24 05:06:07 +04:00
parent 46f958c935
commit bea69429f9
2 changed files with 47 additions and 9 deletions

View File

@ -1,11 +1,13 @@
package assert
import (
"fmt"
"github.com/bloeys/nterm/consts"
)
func T(check bool, msg string) {
func T(check bool, msg string, args ...any) {
if consts.Mode_Debug && !check {
panic("Assert failed: " + msg)
panic("Assert failed: " + fmt.Sprintf(msg, args...))
}
}