You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that adapter types like http.HandlerFunc are incredibly useful. In fact, they are so useful that I want to use them in many places. Frequently, I want to use adapter types to implement io.Reader and io.Writer (and sometimes even io.Closer) behaviors.
Yes, it's not much code to define those adapter types, but it's kind of annoying to have to re-write them in each project. I believe the community would be well-served if these adapter types were established right there in the standard library.
I originally came at this proposal from a code-first approach: https://go-review.googlesource.com/c/go/+/98519 / #24247. Within that PR I found that the io.TeeReader was ripe for re-implementation by an io.ReaderFunc, and in multi_test.go there's already a writerFunc defined that could be replace by a standard io.WriterFunc.
The text was updated successfully, but these errors were encountered:
I believe that adapter types like
http.HandlerFunc
are incredibly useful. In fact, they are so useful that I want to use them in many places. Frequently, I want to use adapter types to implementio.Reader
andio.Writer
(and sometimes evenio.Closer
) behaviors.Yes, it's not much code to define those adapter types, but it's kind of annoying to have to re-write them in each project. I believe the community would be well-served if these adapter types were established right there in the standard library.
I originally came at this proposal from a code-first approach: https://go-review.googlesource.com/c/go/+/98519 / #24247. Within that PR I found that the
io.TeeReader
was ripe for re-implementation by anio.ReaderFunc
, and inmulti_test.go
there's already awriterFunc
defined that could be replace by a standardio.WriterFunc
.The text was updated successfully, but these errors were encountered: