lib: add DummyWriteCloser.

This commit is contained in:
2025-11-20 18:14:33 -08:00
parent 0bdd30f506
commit 8518cc6e56

View File

@@ -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
}