list-type.go: use of copy() for copying lists
This commit is contained in:
parent
93dac956fb
commit
340b99bad7
@ -26,9 +26,10 @@ func newList(listAny []any) (list *ListType) {
|
|||||||
func NewList(listAny []any) (list *ListType) {
|
func NewList(listAny []any) (list *ListType) {
|
||||||
if listAny != nil {
|
if listAny != nil {
|
||||||
ls := make(ListType, len(listAny))
|
ls := make(ListType, len(listAny))
|
||||||
for i, item := range listAny {
|
// for i, item := range listAny {
|
||||||
ls[i] = item
|
// ls[i] = item
|
||||||
}
|
// }
|
||||||
|
copy(ls, listAny)
|
||||||
list = &ls
|
list = &ls
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user