From 507cc341ec2cb96b0199800245f222146f799266 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Mon, 9 Aug 2021 00:52:21 +0700 Subject: [PATCH] doc: add example for conversion from slice expressions to array ptr Fixes #47599 Change-Id: I8f4ccd3b0c2bcdb057ee853163b4421229141333 Reviewed-on: https://go-review.googlesource.com/c/go/+/340351 Trust: Cuong Manh Le Run-TryBot: Cuong Manh Le TryBot-Result: Go Bot Reviewed-by: Keith Randall --- doc/go_spec.html | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/go_spec.html b/doc/go_spec.html index 0e14a1f3b6..fd5fee46eb 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -4329,6 +4329,7 @@ a run-time panic occurs.
 s := make([]byte, 2, 4)
 s0 := (*[0]byte)(s)      // s0 != nil
+s1 := (*[1]byte)(s[1:])  // &s1[0] == &s[1]
 s2 := (*[2]byte)(s)      // &s2[0] == &s[0]
 s4 := (*[4]byte)(s)      // panics: len([4]byte) > len(s)