From 8518cc6e56ffda7d1fe929c29e43f1fd59a55ad6 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Thu, 20 Nov 2025 18:14:33 -0800 Subject: [PATCH] lib: add DummyWriteCloser. --- lib/lib.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/lib.go b/lib/lib.go index 52d47e9..34a6bf5 100644 --- a/lib/lib.go +++ b/lib/lib.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "errors" "fmt" + "io" "os" "path/filepath" "strconv" @@ -329,3 +330,16 @@ func HexEncode(b []byte, mode HexEncodeMode) string { panic("invalid hex encode mode") } } + +// DummyWriteCloser wraps an io.Writer in a struct with a no-op Close. +type DummyWriteCloser struct { + w io.Writer +} + +func (dwc *DummyWriteCloser) Write(p []byte) (int, error) { + return dwc.w.Write(p) +} + +func (dwc *DummyWriteCloser) Close() error { + return nil +}