diff options
Diffstat (limited to 'utils/ioutil')
-rw-r--r-- | utils/ioutil/common.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/ioutil/common.go b/utils/ioutil/common.go index 13db692..f5b78df 100644 --- a/utils/ioutil/common.go +++ b/utils/ioutil/common.go @@ -50,3 +50,15 @@ func (r *readCloser) Close() error { func NewReadCloser(r io.Reader, c io.Closer) io.ReadCloser { return &readCloser{Reader: r, closer: c} } + +type writeNopCloser struct { + io.Writer +} + +func (writeNopCloser) Close() error { return nil } + +// WriteNopCloser returns a WriteCloser with a no-op Close method wrapping +// the provided Writer w. +func WriteNopCloser(w io.Writer) io.WriteCloser { + return writeNopCloser{w} +} |