aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-08 03:21:58 +0800
committerGravatar Runxi Yu2026-03-08 03:21:58 +0800
commit3ec995bbe8009d1550ea3e2005e7e544aac2ad2e (patch)
tree59e8ef3b589c903edf59dc49b1c1b5618e1a4466
parentreceivepack: Progress writing and such (diff)
signatureNo signature
internal/utils: Add WriteProgressf
-rw-r--r--internal/utils/progress.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/utils/progress.go b/internal/utils/progress.go
new file mode 100644
index 00000000..f97dedc6
--- /dev/null
+++ b/internal/utils/progress.go
@@ -0,0 +1,18 @@
+// Package utils provides misc utilities.
+package utils
+
+import (
+ "fmt"
+ "io"
+)
+
+// WriteProgressf writes one formatted progress message to w.
+//
+// It is nil-safe and ignores write errors by design.
+func WriteProgressf(w io.Writer, format string, args ...any) {
+ if w == nil {
+ return
+ }
+
+ _, _ = fmt.Fprintf(w, format, args...)
+}