Skip to content

support hiden interface #23

Description

@visualfc
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions