Skip to content

Conversation

@rohmanhm
Copy link
Contributor

The builtin copy(dst, src) copies min(len(dst), len(src)) elements.

So if your dst is one, only one element will be copied.

https://golang.org/ref/spec#Appending_and_copying_slices

The number of elements copied is the minimum of len(src) and len(dst).

The builtin copy(dst, src) copies min(len(dst), len(src)) elements.

So if your dst is one, only one element will be copied.

https://golang.org/ref/spec#Appending_and_copying_slices
```
The number of elements copied is the minimum of len(src) and len(dst).
```
@rohmanhm
Copy link
Contributor Author

I put the playground here.
https://play.golang.org/p/GqtRKhupuct

@novalagung novalagung merged commit 35163ab into novalagung:master Oct 25, 2018
@novalagung
Copy link
Owner

Thank you. I put additional explanation and example to avoid some confusions to new users.
The book will be updated in few minutes.

@rohmanhm rohmanhm deleted the patch-1 branch February 11, 2022 14:38
novalagung pushed a commit that referenced this pull request Sep 1, 2023
Update A-client-http-request-simple.md
novalagung added a commit that referenced this pull request Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants