On Fri, Apr 28, 2023 at 3:09 PM Nitin Muppalaneni <
muppa...@gmail.com> wrote:
>
> I understand that interface does not provide the implementation. Perhaps my question was not clear. Let me try with the code snippets.
>
> This is how http.ResponseWriter is written:
> type http.ResponseWriter interface {
> ...
> Write([]byte) (int, error)
> ...
> }
>
> But it could have also been written this way:
> type http.ResponseWriter interface {
> ...
> io.Writer
> ...
> }
>
> The second one uses embedding (
https://go.dev/doc/effective_go#embedding), which I thought is preferable. I was curious why embedding was not used here and more broadly, when not to use embedding.