On Thu, Apr 12, 2018 at 4:10 AM, bonpi bonpi <golangori...@gmail.com> wrote: > > I know that there are no functional differences in them by duck typing. > But since the Response package already has dependency on the io package(for > example,http.File), so it does not have to lose its dependency, > and I do not think that "Write([]byte)(int,error)" of ResponseWriter has a > broader meaning so that many other "String() string" declarations do not > embed fmt.Stringer. > > Why does not http.ResponseWriter embed io.Writer? > I think that the reason will help us understand the interface of Golang more > deeply.
I don't think there was any special reason. The end result is exactly the same whether the interface says `io.Writer` or `Write([]byte) (int, error)`. Using an explicit Write method is only slightly longer, and is, if anything, more clear. Ian -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.