Fix calls to die.With.

This commit is contained in:
2025-11-15 16:10:14 -08:00
parent 547a0d8f32
commit 3d9625b40b
2 changed files with 10 additions and 10 deletions

View File

@@ -55,22 +55,22 @@ func To(w io.WriteCloser) *DebugPrinter {
} }
// Print calls fmt.Print if Enabled is true. // Print calls fmt.Print if Enabled is true.
func (dbg *DebugPrinter) Print(v any) { func (dbg *DebugPrinter) Print(v ...any) {
if dbg.Enabled { if dbg.Enabled {
fmt.Fprint(dbg.out, v) fmt.Fprint(dbg.out, v...)
} }
} }
// Println calls fmt.Println if Enabled is true. // Println calls fmt.Println if Enabled is true.
func (dbg *DebugPrinter) Println(v any) { func (dbg *DebugPrinter) Println(v ...any) {
if dbg.Enabled { if dbg.Enabled {
fmt.Fprintln(dbg.out, v) fmt.Fprintln(dbg.out, v...)
} }
} }
// Printf calls fmt.Printf if Enabled is true. // Printf calls fmt.Printf if Enabled is true.
func (dbg *DebugPrinter) Printf(format string, v any) { func (dbg *DebugPrinter) Printf(format string, v ...any) {
if dbg.Enabled { if dbg.Enabled {
fmt.Fprintf(dbg.out, format, v) fmt.Fprintf(dbg.out, format, v...)
} }
} }

View File

@@ -16,15 +16,15 @@ func If(err error) {
} }
// With prints the message to stderr, appending a newline, and exits. // With prints the message to stderr, appending a newline, and exits.
func With(fstr string, args any) { func With(fstr string, args ...any) {
out := fmt.Sprintf("[!] %s\n", fstr) out := fmt.Sprintf("[!] %s\n", fstr)
fmt.Fprintf(os.Stderr, out, args) fmt.Fprintf(os.Stderr, out, args...)
os.Exit(1) os.Exit(1)
} }
// When prints the error to stderr and exits if cond is true. // When prints the error to stderr and exits if cond is true.
func When(cond bool, fstr string, args any) { func When(cond bool, fstr string, args ...any) {
if cond { if cond {
With(fstr, args) With(fstr, args...)
} }
} }