lib: add DummyWriteCloser.
This commit is contained in:
14
lib/lib.go
14
lib/lib.go
@@ -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
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user