Descriptionreflect: support for struct tag use by multiple packages
Each package using struct field tags assumes that
it is the only package storing data in the tag.
This CL adds support in package reflect for sharing
tags between multiple packages. In this scheme, the
tags must be of the form
key:"value" key2:"value2"
(raw strings help when writing that tag in Go source).
reflect.StructField's Tag field now has type StructTag
(a string type), which has method Get(key string) string
that returns the associated value.
Clients of json and xml will need to be updated.
Code that says
type T struct {
X int "name"
}
should become
type T struct {
X int `json:"name"` // or `xml:"name"`
}
Use govet to identify struct tags that need to be changed
to use the new syntax.
Patch Set 1 #Patch Set 2 : diff -r a1541ae18b69 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r a1541ae18b69 https://go.googlecode.com/hg/ #
Total comments: 3
Patch Set 4 : diff -r 96427f267d49 https://go.googlecode.com/hg/ #
Total comments: 1
Patch Set 5 : diff -r 96427f267d49 https://go.googlecode.com/hg/ #Patch Set 6 : diff -r 96427f267d49 https://go.googlecode.com/hg/ #
Total comments: 2
Patch Set 7 : diff -r 96427f267d49 https://go.googlecode.com/hg/ #Patch Set 8 : diff -r 96427f267d49 https://go.googlecode.com/hg/ #Patch Set 9 : diff -r e2dd614a21df https://go.googlecode.com/hg/ #
Total comments: 3
Patch Set 10 : diff -r b3e7f469a443 https://go.googlecode.com/hg/ #Patch Set 11 : diff -r b3e7f469a443 https://go.googlecode.com/hg/ #Patch Set 12 : diff -r b3e7f469a443 https://go.googlecode.com/hg/ #
Total comments: 3
Patch Set 13 : diff -r dd7479dd252a https://go.googlecode.com/hg/ #
MessagesTotal messages: 29
|