此类方法可能表明接收器类型旨在满足标准库中的接口,但由于方法签名中的错误而无法满足。
示例:
type MyReader []byte
func (r MyReader) ReadByte(data []byte) (byte, error) {
}
这种用法很可疑,因为它看起来像是试图实现 io.ByteReader
,但签名不正确。
下面这样写比较合适:
type MyReader []byte
func (r MyReader) ReadByte() (byte, error) {
}