Commit 0436a89a authored by Robert Griesemer's avatar Robert Griesemer

spec: be more explicit about equivalence of empty string and absent field tags

Note that the spec already makes that point with a comment in the very first
example for struct field tags. This change is simply stating this explicitly
in the actual spec prose.

- gccgo and go/types already follow this rule
- the current reflect package API doesn't distinguish between absent tags
  and empty tags (i.e., there is no discoverable difference)

Fixes #15412.

Change-Id: I92f9c283064137b4c8651630cee0343720717a02
Reviewed-on: https://go-review.googlesource.com/22391Reviewed-by: default avatarRuss Cox <rsc@golang.org>
Reviewed-by: default avatarRob Pike <r@golang.org>
parent 9dcbc43f
<!--{ <!--{
"Title": "The Go Programming Language Specification", "Title": "The Go Programming Language Specification",
"Subtitle": "Version of April 21, 2016", "Subtitle": "Version of April 25, 2016",
"Path": "/ref/spec" "Path": "/ref/spec"
}--> }-->
...@@ -1043,8 +1043,8 @@ promoted methods are included in the method set of the struct as follows: ...@@ -1043,8 +1043,8 @@ promoted methods are included in the method set of the struct as follows:
<p> <p>
A field declaration may be followed by an optional string literal <i>tag</i>, A field declaration may be followed by an optional string literal <i>tag</i>,
which becomes an attribute for all the fields in the corresponding which becomes an attribute for all the fields in the corresponding
field declaration. The tags are made field declaration. An empty tag string is equivalent to an absent tag.
visible through a <a href="/pkg/reflect/#StructTag">reflection interface</a> The tags are made visible through a <a href="/pkg/reflect/#StructTag">reflection interface</a>
and take part in <a href="#Type_identity">type identity</a> for structs and take part in <a href="#Type_identity">type identity</a> for structs
but are otherwise ignored. but are otherwise ignored.
</p> </p>
......
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