Commit 7305b55e authored by Robert Griesemer's avatar Robert Griesemer

spec: clarify examples for struct field tags

Fixes #13420.

Change-Id: Id64ebd0527881450fdaffbb66d8b1831a6b7c43c
Reviewed-on: https://go-review.googlesource.com/17263Reviewed-by: default avatarRob Pike <r@golang.org>
parent 06f4cbd3
<!--{
"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>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment