func DecodeVarint(buf []byte) (x uint64, n int) {
	for shift := uint(0); ; shift += 7 {
		if n >= len(buf) {
			return 0, 0
		}
		b := uint64(buf[n])
		n++
		x |= (b & 0x7F) << shift
		if (b & 0x80) == 0 {
			break
		}
	}
	return x, n
}
The fundamental decoders that interpret bytes on the wire.
Those that take integer types all return uint64 and are
therefore of type valueDecoder.
DecodeVarint reads a varint-encoded integer from the slice.
It returns the integer and the number of bytes consumed, or
zero if there is not enough.
This is the format for the
int32, int64, uint32, uint64, bool, and enum
protocol buffer types.
package proto
import (
	"errors"
	"fmt"
	"io"
	"os"
	"reflect"
	"runtime"
	"unsafe"
)
var ErrWrongType = errors.New("field/encoding mismatch: wrong type for field")