gopherjs icon indicating copy to clipboard operation
gopherjs copied to clipboard

support hiden interface

Open visualfc opened this issue 5 years ago • 0 comments

package main

import (
	"bytes"
	"io"
	"log"
)

// A version of bytes.Buffer without ReadFrom and WriteTo
type Buffer struct {
	bytes.Buffer
	io.ReaderFrom // conflicts with and hides bytes.Buffer's ReaderFrom.
	io.WriterTo   // conflicts with and hides bytes.Buffer's WriterTo.
}

func main() {
	b := new(Buffer)
	var i interface{} = b
	if v, ok := i.(io.WriterTo); ok {
		log.Println("error", v)
	}
}

---- output ------

error

visualfc avatar Feb 19 '21 14:02 visualfc