Skip to content

Commit

Permalink
Merge pull request jmoiron#462 from ferhatelmas/copy-for-loop
Browse files Browse the repository at this point in the history
reflectx: use copy instead of for loop
  • Loading branch information
jmoiron authored Oct 16, 2018
2 parents d161d7a + e6b4972 commit 2fc13f5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions reflectx/reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ type typeQueue struct {
// A copying append that creates a new slice each time.
func apnd(is []int, i int) []int {
x := make([]int, len(is)+1)
for p, n := range is {
x[p] = n
}
copy(x, is)
x[len(x)-1] = i
return x
}
Expand Down

0 comments on commit 2fc13f5

Please sign in to comment.