writeOutError surfaces deferred write errors from writers that record them (lazyFileWriter); plain writers such as os.Stdout report nil.
(out io.Writer)
| 687 | // writeOutError surfaces deferred write errors from writers that record them |
| 688 | // (lazyFileWriter); plain writers such as os.Stdout report nil. |
| 689 | func writeOutError(out io.Writer) error { |
| 690 | if r, ok := out.(interface{ Err() error }); ok { |
| 691 | return r.Err() |
| 692 | } |
| 693 | return nil |
| 694 | } |
| 695 | |
| 696 | // Close commits a complete output file atomically. It is a no-op when no Write |
| 697 | // occurred, and it discards the temporary file when a Write already failed. |