]> Cypherpunks.ru repositories - gostls13.git/commitdiff
spec: clarify that []byte("") must be non-nil
authorMatthew Dempsky <mdempsky@google.com>
Fri, 18 Aug 2023 22:52:34 +0000 (15:52 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 21 Aug 2023 23:20:08 +0000 (23:20 +0000)
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 <gri@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>

doc/go_spec.html

index a65e466fe4ee5ff0664764670ea6a6998cd398a7..0806fd738b0d0132d2d0d73dc7a64bdb32d41afb 100644 (file)
@@ -1,6 +1,6 @@
 <!--{
        "Title": "The Go Programming Language Specification",
-       "Subtitle": "Version of Aug 18, 2023",
+       "Subtitle": "Version of Aug 21, 2023",
        "Path": "/ref/spec"
 }-->
 
@@ -5570,7 +5570,7 @@ myString([]myRune{0x1f30e})              // "\U0001f30e" == "🌎"
 
 <li>
 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.
 
 <pre>
 []byte("hellø")             // []byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'}