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