func (array *Array) Add(index int, value interface{}) (err error) {
	if index < 0 || index > array.size {
		err = errors.New("sdd failed. Require index >= 0 and index <= size")
		return
	}
	capLen := array.CapLength()
	if array.size == capLen {
		array.resize(capLen * 2)
	}
	for i := array.size - 1; i >= index; i-- {
		array.data[i+1] = array.data[i]
	}
	array.data[index] = value
	array.size++
	return
}
Set in the index position insert the element
package zarray
import (
	"errors"
	"fmt"
)
type Array struct {
	data []interface{}
	size int
}
var ERR_ILLEGAL_INDEX = errors.New("illegal index")
func New(capacity ...int) (array *Array) {
	if len(capacity) >= 1 && capacity[0] != 0 {
		array = &Array{
			data: make([]interface{}, capacity[0]),
			size: 0,
		}
	} else {
		array = &Array{
			data: make([]interface{}, 10),
			size: 0,
		}
	}
	return
}
func Copy(arr interface{}) (array *Array, err error) {
	data, ok := arr.([]interface{})
	if ok {
		l := len(data)
		array = New(l)
		for i := 0; i < l; i++ {
			array.Push(data[i])
		}
	} else {
		err = errors.New("type of error")
	}
	return
}
func (array *Array) checkIndex(index int) (bool, int) {
	size := array.size
	if index < 0 || index >= size {
		return true, size
	}
	return false, size
}
func (array *Array) resize(capacity int) {
	newArray := make([]interface{}, capacity)
	for i := 0; i < array.size; i++ {
		newArray[i] = array.data[i]
	}
	array.data = newArray
}
func (array *Array) CapLength() int {
	return cap(array.data)
}
func (array *Array) Length() int {
	return array.size
}
func (array *Array) IsEmpty() bool {
	return array.size == 0
}
func (array *Array) Unshift(value interface{}) error {
	return array.Add(0, value)
}
func (array *Array) Push(values ...interface{}) {
	for i := 0; i < len(values); i++ {
		_ = array.Add(array.size, values[i])
	}
}