1
0
mirror of https://github.com/golang/go synced 2024-11-25 20:57:57 -07:00
go/src/pkg/asn1
Russ Cox 25733a94fd reflect: 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.

R=r, r, dsymonds, bradfitz, kevlar, fvbommel, n13m3y3r
CC=golang-dev
https://golang.org/cl/4645069
2011-06-29 09:52:34 -04:00
..
asn1_test.go reflect: support for struct tag use by multiple packages 2011-06-29 09:52:34 -04:00
asn1.go reflect: support for struct tag use by multiple packages 2011-06-29 09:52:34 -04:00
common.go strings.Split: make the default to split all. 2011-06-28 09:43:14 +10:00
Makefile build: no required environment variables 2010-08-18 10:08:49 -04:00
marshal_test.go reflect: support for struct tag use by multiple packages 2011-06-29 09:52:34 -04:00
marshal.go reflect: support for struct tag use by multiple packages 2011-06-29 09:52:34 -04:00