func (ctx *Context) newDefaultValue(objType reflect.Type, opts *fieldOptions) (reflect.Value, error) {
	value := reflect.New(objType).Elem()
	if opts.defaultValue == nil {
		return value, nil
	}
	return value, ctx.setDefaultValue(value, opts)
}
newDefaultValue creates a new reflected value and sets it to its default value.
package asn1
import (
	"fmt"
	"reflect"
)
const (
	tagKey = "asn1"
)
func Encode(obj interface{}) (data []byte, err error) {
	ctx := NewContext()
	return ctx.EncodeWithOptions(obj, "")
}
func EncodeWithOptions(obj interface{}, options string) (data []byte, err error) {
	ctx := NewContext()
	return ctx.EncodeWithOptions(obj, options)
}
func Decode(data []byte, obj interface{}) (rest []byte, err error) {
	ctx := NewContext()
	return ctx.DecodeWithOptions(data, obj, "")
}
func DecodeWithOptions(data []byte, obj interface{}, options string) (rest []byte, err error) {
	ctx := NewContext()
	return ctx.DecodeWithOptions(data, obj, options)
}
type ParseError struct {
	Msg string
}
func (e *ParseError) Error() string {
	return e.Msg
}
func parseError(msg string, args ...interface{}) *ParseError {
	return &ParseError{fmt.Sprintf(msg, args...)}
}
type SyntaxError struct {
	Msg string
}
func (e *SyntaxError) Error() string {
	return e.Msg
}
func syntaxError(msg string, args ...interface{}) *SyntaxError {
	return &SyntaxError{fmt.Sprintf(msg, args...)}
}
func (ctx *Context) setDefaultValue(value reflect.Value, opts *fieldOptions) error {
	switch value.Kind() {
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		value.SetInt(int64(*opts.defaultValue))
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		value.SetUint(uint64(*opts.defaultValue))
	default:
		return syntaxError("default value is only allowed to integers")
	}
	return nil
}