gitlab.com/evatix-go/core@v1.3.55/coredata/stringslice/MergeNew.go (about) 1 package stringslice 2 3 import ( 4 "gitlab.com/evatix-go/core/constants" 5 ) 6 7 func MergeNew(firstSlice []string, additionalItems ...string) *[]string { 8 sliceLength := len(firstSlice) 9 additionalItemsLength := len(additionalItems) 10 11 newSlice := make( 12 []string, 13 constants.Zero, 14 sliceLength+additionalItemsLength) 15 16 if sliceLength > 0 { 17 newSlice = append(newSlice, firstSlice...) 18 } 19 20 if additionalItemsLength > 0 { 21 newSlice = append(newSlice, additionalItems...) 22 } 23 24 return &newSlice 25 }