FAQ
In this little example, three Writers are chained.

    transform.Writer -> bufio.Writer -> os.File

https://play.golang.org/p/fXNDxNf0Tk

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 ?


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 5 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 1, '15 at 8:56p
activeDec 1, '15 at 11:50p
posts5
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase