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" "encoding/hex"
"errors" "errors"
"fmt" "fmt"
"io"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
@@ -329,3 +330,16 @@ func HexEncode(b []byte, mode HexEncodeMode) string {
panic("invalid hex encode mode") 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
}