code: func MarshalAny(v interface{}) (*types.Any, error) {
  	var marshal func(v interface{}) ([]byte, error)
  	switch t := v.(type) {
  	case *types.Any:
  		// avoid reserializing the type if we have an any.
  		return t, nil
  	case proto.Message:
  		marshal = func(v interface{}) ([]byte, error) {
  			return proto.Marshal(t)
  		}
  	default:
  		marshal = json.Marshal
  	}
  
  	url, err := TypeURL(v)
  	if err != nil {
  		return nil, err
  	}
  
  	data, err := marshal(v)
  	if err != nil {
  		return nil, err
  	}
  	return &types.Any{
  		TypeUrl: url,
  		Value:   data,
  	}, nil
  }
docs: // MarshalAny marshals the value v into an any with the correct TypeUrl