From 334984a92a33cd11a12071c03374916162188e2f Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Wed, 14 Sep 2022 11:51:59 +0700 Subject: [PATCH] spec: describe an edge case for slice expression of nil slice Change-Id: I8c0e2b37e7e8cb4db6ad0b456fde7eb908ffbd04 Reviewed-on: https://go-review.googlesource.com/c/go/+/430836 Reviewed-by: Robert Griesemer TryBot-Result: Gopher Robot Run-TryBot: Cuong Manh Le Auto-Submit: Cuong Manh Le Reviewed-by: Cherry Mui Auto-Submit: Robert Griesemer --- doc/go_spec.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/go_spec.html b/doc/go_spec.html index e2163b466d..c188cd4c1f 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -3934,6 +3934,9 @@ 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 + +var s []int +s3 := s[:0] // s3 == nil -- 2.48.1