In this little example, three Writers are chained.
When I want to close the Writers, I must:
- close the transform.Writer
- flush the bufio.Writer
- close the os.File
I just wondered why Flush and Close don't "cascade" down the chain.
That is, calling Close on transform.Writer should call Flush on bufio.Writer, which would call Close on os.File.
It seems to me that the abstraction of io.WriteCloser is leaky, as the underlying Writer must be flushed and closed explicitely.
Have I missed some explanation ?