func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error {
	if atomic.LoadInt32(&u.initialized) == 0 {
		u.computeUnmarshalInfo()
	}
	if u.isMessageSet {
		return UnmarshalMessageSet(b, m.offset(u.extensions).toExtensions())
	}
	var reqMask uint64             
	var rnse *RequiredNotSetError  
	for len(b) > 0 {
		var x uint64
		if b[0] < 128 {
			x = uint64(b[0])
			b = b[1:]
		} else if len(b) >= 2 && b[1] < 128 {
			x = uint64(b[0]&0x7f) + uint64(b[1])<<7
			b = b[2:]
		} else {
			var n int
			x, n = decodeVarint(b)
			if n == 0 {
				return io.ErrUnexpectedEOF
			}
			b = b[n:]
		}
		tag := x >> 3
		wire := int(x) & 7
		var f unmarshalFieldInfo
		if tag < uint64(len(u.dense)) {
			f = u.dense[tag]
		} else {
			f = u.sparse[tag]
		}
		if fn := f.unmarshal; fn != nil {
			var err error
			b, err = fn(b, m.offset(f.field), wire)
			if err == nil {
				reqMask |= f.reqMask
				continue
			}
			if r, ok := err.(*RequiredNotSetError); ok {
				rnse = r
				reqMask |= f.reqMask
				continue
			}
			if err != errInternalBadWireType {
				return err
			}
		}
		if !u.unrecognized.IsValid() {
			var err error
			b, err = skipField(b, wire)
			if err != nil {
				return err
			}
			continue
		}
		z := m.offset(u.unrecognized).toBytes()
		var emap map[int32]Extension
		var e Extension
		for _, r := range u.extensionRanges {
			if uint64(r.Start) <= tag && tag <= uint64(r.End) {
				if u.extensions.IsValid() {
					mp := m.offset(u.extensions).toExtensions()
					emap = mp.extensionsWrite()
					e = emap[int32(tag)]
					z = &e.enc
					break
				}
				if u.oldExtensions.IsValid() {
					p := m.offset(u.oldExtensions).toOldExtensions()
					emap = *p
					if emap == nil {
						emap = map[int32]Extension{}
						*p = emap
					}
					e = emap[int32(tag)]
					z = &e.enc
					break
				}
				panic("no extensions field available")
			}
		}
		var err error
		b0 := b
		b, err = skipField(b, wire)
		if err != nil {
			return err
		}
		*z = encodeVarint(*z, tag<<3|uint64(wire))
		*z = append(*z, b0[:len(b0)-len(b)]...)
		if emap != nil {
			emap[int32(tag)] = e
		}
	}
	if rnse != nil {
		return rnse
	}
	if reqMask != u.reqMask {
		for _, n := range u.reqFields {
			if reqMask&1 == 0 {
				return &RequiredNotSetError{n}
			}
			reqMask >>= 1
		}
	}
	return nil
}
unmarshal does the main work of unmarshaling a message.
u provides type information used to unmarshal the message.
m is a pointer to a protocol buffer message.
b is a byte stream to unmarshal into m.
This is top routine used when recursively unmarshaling submessages.
package proto
import (
	"errors"
	"fmt"
	"io"
	"math"
	"reflect"
	"strconv"
	"strings"
	"sync"
	"sync/atomic"
	"unicode/utf8"
)
func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error {
	u := atomicLoadUnmarshalInfo(&a.unmarshal)
	if u == nil {
		u = getUnmarshalInfo(reflect.TypeOf(msg).Elem())
		atomicStoreUnmarshalInfo(&a.unmarshal, u)
	}
	err := u.unmarshal(toPointer(&msg), b)
	return err
}
type unmarshalInfo struct {
	typ reflect.Type  
	initialized     int32
	lock            sync.Mutex                     
	dense           []unmarshalFieldInfo           
	sparse          map[uint64]unmarshalFieldInfo  
	reqFields       []string                       
	reqMask         uint64                         
	unrecognized    field                          
	extensions      field                          
	oldExtensions   field                          
	extensionRanges []ExtensionRange               
	isMessageSet    bool                           
}
type unmarshaler func(b []byte, f pointer, w int) ([]byte, error)
type unmarshalFieldInfo struct {
	field field
	unmarshal unmarshaler
	reqMask uint64
}
var (
	unmarshalInfoMap  = map[reflect.Type]*unmarshalInfo{}
	unmarshalInfoLock sync.Mutex
)
func getUnmarshalInfo(t reflect.Type) *unmarshalInfo {
	unmarshalInfoLock.Lock()
	defer unmarshalInfoLock.Unlock()
	u := unmarshalInfoMap[t]
	if u == nil {
		u = &unmarshalInfo{typ: t}
		unmarshalInfoMap[t] = u
	}
	return u
}