func (d *Decoder) Decode(v interface{}) (err error) {
	rv := reflect.Indirect(reflect.ValueOf(v))
	if !rv.CanAddr() {
		return errors.New("binary: can only Decode to pointer type")
	}
	var c Codec
	if c, err = scanToCache(rv.Type(), d.schemas); err == nil {
		err = c.DecodeTo(d, rv)
	}
	return
}
Decode decodes a value by reading from the underlying io.Reader.
package binary
import (
	"encoding/binary"
	"errors"
	"io"
	"math"
	"reflect"
	"sync"
)
var decoders = &sync.Pool{New: func() interface{} {
	return NewDecoder(newReader(nil))
}}
type Reader interface {
	io.Reader
	io.ByteReader
}
func Unmarshal(b []byte, v interface{}) (err error) {
	d := decoders.Get().(*Decoder)
	d.r.(*reader).Reset(b)  
	err = d.Decode(v)
	decoders.Put(d)
	return
}
type Decoder struct {
	r       Reader
	s       *reader  
	scratch [10]byte
	schemas map[reflect.Type]Codec
}
func NewDecoder(r Reader) *Decoder {
	var slicer *reader
	if s, ok := r.(*reader); ok {
		slicer = s
	}
	return &Decoder{
		r:       r,
		s:       slicer,
		schemas: make(map[reflect.Type]Codec),
	}
}