diff options
| author | 2026-06-08 05:49:14 +0000 | |
|---|---|---|
| committer | 2026-06-08 05:49:14 +0000 | |
| commit | 72289ba472f3e5bdc2fed0d38b1767dc6a5972b9 (patch) | |
| tree | fe6f1a76bda15670398f7dfe6be17b5e9b53ec8b | |
| parent | REFACTOR: priorityqueue is done (diff) | |
| signature | No signature | |
internal/utils: Add best effort Fprintf
| -rw-r--r-- | internal/utils/doc.go | 2 | ||||
| -rw-r--r-- | internal/utils/fprintf.go | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/internal/utils/doc.go b/internal/utils/doc.go new file mode 100644 index 00000000..58c77fd8 --- /dev/null +++ b/internal/utils/doc.go @@ -0,0 +1,2 @@ +// Package utils provides misc utilities. +package utils diff --git a/internal/utils/fprintf.go b/internal/utils/fprintf.go new file mode 100644 index 00000000..e1680d0c --- /dev/null +++ b/internal/utils/fprintf.go @@ -0,0 +1,17 @@ +package utils + +import ( + "fmt" + "io" +) + +// BestEffortFprintf writes one formatted message to w. +// +// It is nil-safe and ignores write errors by design. +func BestEffortFprintf(w io.Writer, format string, args ...any) { + if w == nil { + return + } + + _, _ = fmt.Fprintf(w, format, args...) +} |
