From: Matthew Dempsky Date: Fri, 18 Aug 2023 22:52:34 +0000 (-0700) Subject: spec: clarify that []byte("") must be non-nil X-Git-Tag: go1.22rc1~1168 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ba6fe5172d5dbd604ef6f535ce54fc70f0c0d1d5;p=gostls13.git spec: clarify that []byte("") must be non-nil The example text below suggests that []byte("") always evaluates to the non-nil value []byte{}, but the text proper doesn't explicitly require that. This CL makes it clear that it must not evaluate to []byte(nil), which otherwise was allowed by the wording. Change-Id: I6564bfd5e2fd0c820d9b55d17406221ff93ce80c Reviewed-on: https://go-review.googlesource.com/c/go/+/521035 Reviewed-by: Robert Griesemer Auto-Submit: Matthew Dempsky TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Run-TryBot: Matthew Dempsky --- diff --git a/doc/go_spec.html b/doc/go_spec.html index a65e466fe4..0806fd738b 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -5570,7 +5570,7 @@ myString([]myRune{0x1f30e}) // "\U0001f30e" == "🌎"
  • Converting a value of a string type to a slice of bytes type -yields a slice whose successive elements are the bytes of the string. +yields a non-nil slice whose successive elements are the bytes of the string.
     []byte("hellø")             // []byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'}