]> Cypherpunks repositories - gostls13.git/commitdiff
spec: clarify examples for struct field tags
authorRobert Griesemer <gri@golang.org>
Mon, 30 Nov 2015 22:18:09 +0000 (14:18 -0800)
committerRobert Griesemer <gri@golang.org>
Mon, 30 Nov 2015 22:24:13 +0000 (22:24 +0000)
Fixes #13420.

Change-Id: Id64ebd0527881450fdaffbb66d8b1831a6b7c43c
Reviewed-on: https://go-review.googlesource.com/17263
Reviewed-by: Rob Pike <r@golang.org>
doc/go_spec.html

index 7e42bc33ee45c1e1cefe3a24aeb2f9bcd522eb93..9178ccd0685e1fb92e785bdea8a7de6fb4e41c55 100644 (file)
@@ -1,6 +1,6 @@
 <!--{
        "Title": "The Go Programming Language Specification",
-       "Subtitle": "Version of November 25, 2015",
+       "Subtitle": "Version of November 30, 2015",
        "Path": "/ref/spec"
 }-->
 
@@ -1051,12 +1051,18 @@ but are otherwise ignored.
 </p>
 
 <pre>
-// A struct corresponding to the TimeStamp protocol buffer.
-// The tag strings define the protocol buffer field numbers.
 struct {
-       microsec  uint64 "field 1"
-       serverIP6 uint64 "field 2"
-       process   string "field 3"
+       x, y float64 ""  // an empty tag string is like an absent tag
+       name string  "any string is permitted as a tag"
+       _    [4]byte "ceci n'est pas un champ de structure"
+}
+
+// A struct corresponding to a TimeStamp protocol buffer.
+// The tag strings define the protocol buffer field numbers;
+// they follow the convention outlined by the reflect package.
+struct {
+       microsec  uint64 `protobuf:"1"`
+       serverIP6 uint64 `protobuf:"2"`
 }
 </pre>