github.com/seeker-insurance/kit@v0.0.13/copyslice/copyslice.go (about) 1 //Package copyslice contains functions to create copies of various slice types. 2 package copyslice 3 4 //Int copies a []int 5 func Int(src []int) []int { 6 dst := make([]int, len(src)) 7 copy(dst, src) 8 return dst 9 } 10 11 //Uint copies a []uint 12 func Uint(src []uint) []uint { 13 dst := make([]uint, len(src)) 14 copy(dst, src) 15 return dst 16 } 17 18 //String copies a []string 19 func String(src []string) []string { 20 dst := make([]string, len(src)) 21 copy(dst, src) 22 return dst 23 } 24 25 //Rune copies a []rune 26 func Rune(src []rune) []rune { 27 dst := make([]rune, len(src)) 28 copy(dst, src) 29 return dst 30 } 31 32 //Byte copies a []byte 33 func Byte(src []byte) []byte { 34 dst := make([]byte, len(src)) 35 copy(dst, src) 36 return dst 37 } 38 39 //Int64 copies a []int64 40 func Int64(src []int64) []int64 { 41 dst := make([]int64, len(src)) 42 copy(dst, src) 43 return dst 44 } 45 46 //Float64 copies a []Float64 47 func Float64(src []float64) []float64 { 48 dst := make([]float64, len(src)) 49 copy(dst, src) 50 return dst 51 } 52 53 //Uint64 copies a []Uint64 54 func Uint64(src []uint64) []uint64 { 55 dst := make([]uint64, len(src)) 56 copy(dst, src) 57 return dst 58 }