Skip to content

Commit

Permalink
fix #182 copy of slice doesn't replace the whole slice
Browse files Browse the repository at this point in the history
  • Loading branch information
jheroy committed May 17, 2023
1 parent 83982c7 commit 7e37c0f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions copier.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,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 7e37c0f

Please sign in to comment.