1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:44:41 -07:00

slices: print modified cloned slice in ExampleClone

Make it obvious that numbers wasn't modified, but clone was.

Change-Id: Id8bd4ca59b7348cd218faef61abfdf12e20c89f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/617795
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Tobias Klauser 2024-10-03 17:23:22 +02:00 committed by Gopher Robot
parent 1edb49a6eb
commit fe87349002

View File

@ -325,9 +325,11 @@ func ExampleClone() {
fmt.Println(clone)
clone[2] = 10
fmt.Println(numbers)
fmt.Println(clone)
// Output:
// [0 42 -10 8]
// [0 42 -10 8]
// [0 42 10 8]
}
func ExampleGrow() {