diff --git a/doc/go_spec.html b/doc/go_spec.html index dea3afe498d..fb4341be1db 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -3262,6 +3262,14 @@ is a nil slice. Otherwise, if the result is a slice, it shares its array with the operand.

+
+var a [10]int
+s1 := a[3:7]   // underlying array of s1 is array a; &s1[2] == &a[5]
+s2 := s1[1:4]  // underlying array of s2 is underlying array of s1 which is array a; &s2[1] == &a[5]
+s2[1] = 42     // s2[1] == s1[2] == a[5] == 42; they all refer to the same underlying array element
+
+ +

Full slice expressions