mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: document multiple keys in struct tags
For #40281 Fixes #42959 Change-Id: Ibc4769fda1592a1373ec720ea30baf319c0a0136 Reviewed-on: https://go-review.googlesource.com/c/go/+/274448 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
7ad6596c47
commit
9b8c272558
1 changed files with 10 additions and 6 deletions
|
|
@ -1104,12 +1104,16 @@ type StructField struct {
|
||||||
|
|
||||||
// A StructTag is the tag string in a struct field.
|
// A StructTag is the tag string in a struct field.
|
||||||
//
|
//
|
||||||
// By convention, tag strings are a concatenation of
|
// By convention, tag strings are a mapping of keys to values.
|
||||||
// optionally space-separated key:"value" pairs.
|
// The format is key:"value". Each key is a non-empty string consisting
|
||||||
// Each key is a non-empty string consisting of non-control
|
// of non-control characters other than space (U+0020 ' '),
|
||||||
// characters other than space (U+0020 ' '), quote (U+0022 '"'),
|
// quote (U+0022 '"'), and colon (U+003A ':'). Each value is quoted
|
||||||
// and colon (U+003A ':'). Each value is quoted using U+0022 '"'
|
// using U+0022 '"' characters and Go string literal syntax.
|
||||||
// characters and Go string literal syntax.
|
// Multiple key-value mappings are separated by zero or more spaces, as in
|
||||||
|
// key1:"value1" key2:"value2"
|
||||||
|
// Multiple keys may map to a single shared value by separating the keys
|
||||||
|
// with spaces, as in
|
||||||
|
// key1 key2:"value"
|
||||||
type StructTag string
|
type StructTag string
|
||||||
|
|
||||||
// Get returns the value associated with key in the tag string.
|
// Get returns the value associated with key in the tag string.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue