mirror of
https://github.com/golang/go
synced 2024-11-22 11:24:49 -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:
parent
1edb49a6eb
commit
fe87349002
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user