]> Cypherpunks.ru repositories - gostls13.git/commit
bytes: add Clone function
authorMartin Möhrmann <martin@golang.org>
Sun, 31 Oct 2021 09:04:03 +0000 (10:04 +0100)
committerMartin Möhrmann <martin@golang.org>
Mon, 15 Aug 2022 19:17:20 +0000 (19:17 +0000)
commit7b45edb45016307151266731ccd158e14504598f
treeb70331b9b3088514973bac5ad65a15b8ee8a2b38
parent69a8954282dc4500bb645e67fb912d53a7f78a5c
bytes: add Clone function

The new Clone function returns a copy of b[:len(b)]
for the input byte slice b.
The result may have additional unused capacity.
Clone(nil) returns nil.

Fixes #45038

Change-Id: I0469a202d77a7b491f1341c08915d07ddd1f0300
Reviewed-on: https://go-review.googlesource.com/c/go/+/359675
Run-TryBot: Martin Möhrmann <martin@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
api/next/45038.txt [new file with mode: 0644]
src/bytes/bytes.go
src/bytes/bytes_test.go