Skip to content

Commit

Permalink
Merge pull request #185 from jheroy/master
Browse files Browse the repository at this point in the history
fix #182 copy of slice doesn't replace the whole slice
  • Loading branch information
jinzhu committed Mar 17, 2024
2 parents 70b1d4e + 7e37c0f commit 60a1fd2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions copier.go
Expand Up @@ -232,6 +232,11 @@ func copier(toValue interface{}, fromValue interface{}, opt Option) (err error)
}
}
}

if to.Len() > from.Len() {
to.SetLen(from.Len())
}

return
}
}
Expand Down

0 comments on commit 60a1fd2

Please sign in to comment.