slice: introduce common Copy helper
It's a bit more convenient to use.
This commit is contained in:
parent
a54e3516d1
commit
19717dd9a8
14 changed files with 51 additions and 65 deletions
|
@ -21,3 +21,10 @@ func reverse(dst []byte, src []byte) {
|
|||
dst[i], dst[j] = src[j], src[i]
|
||||
}
|
||||
}
|
||||
|
||||
// Copy copies the byte slice into new slice (make/copy).
|
||||
func Copy(b []byte) []byte {
|
||||
d := make([]byte, len(b))
|
||||
copy(d, b)
|
||||
return d
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue