From a37d28e3d70ab4a429b5a16a70136d787bc9bdfb Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Sat, 15 Nov 2025 15:55:17 -0800 Subject: [PATCH] die: linter feedback fixes. --- die/README.md | 12 ------------ die/die.go | 11 ++++++----- 2 files changed, 6 insertions(+), 17 deletions(-) delete mode 100644 die/README.md diff --git a/die/README.md b/die/README.md deleted file mode 100644 index d509d84..0000000 --- a/die/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Simple fatal utilities for Go programs. - -``` - result, err := doSomething() - die.If(err) - - ok := processResult(result) - if !ok { - die.With("failed to process result %s", result.Name) - } -``` - diff --git a/die/die.go b/die/die.go index 7bda7f6..5ecc0a8 100644 --- a/die/die.go +++ b/die/die.go @@ -1,4 +1,5 @@ -// Package die contains utilities for fatal error handling. +// Package die contains utilities for fatal error handling. It +// presents simple fatal utilities for Go programs. package die import ( @@ -15,15 +16,15 @@ func If(err error) { } // With prints the message to stderr, appending a newline, and exits. -func With(fstr string, args ...interface{}) { +func With(fstr string, args any) { out := fmt.Sprintf("[!] %s\n", fstr) - fmt.Fprintf(os.Stderr, out, args...) + fmt.Fprintf(os.Stderr, out, args) os.Exit(1) } // When prints the error to stderr and exits if cond is true. -func When(cond bool, fstr string, args ...interface{}) { +func When(cond bool, fstr string, args any) { if cond { - With(fstr, args...) + With(fstr, args) } }