diff options
| author | Marin Ivanov <[email protected]> | 2022-08-15 06:51:43 +0300 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2022-08-15 06:51:43 +0300 |
| commit | 36b2b55df13d36f7e34e88a1b10df30fe573a0b7 (patch) | |
| tree | 4b96dbabc973cbc0e688d32167243e10752acfc7 /file.go | |
| parent | f8fc14b2e0a10c64de0bd87f831ebde4f705b79b (diff) | |
Add method to close writer with error
Diffstat (limited to 'file.go')
| -rw-r--r-- | file.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -31,6 +31,14 @@ func (f *File) Close() error { return nil } +func (f *File) CloseWriterWithError(err error) error { + if f.w == nil { + return ErrUnsupported + } + pw := f.w.(*io.PipeWriter) + return pw.CloseWithError(err) +} + // implements io.Reader func (f *File) Read(b []byte) (int, error) { if f.r == nil { |
