1
0
mirror of https://github.com/golang/go synced 2024-10-03 03:11:21 -06:00
go/src/pkg/rpc
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
..
jsonrpc reflect: support for struct tag use by multiple packages 2011-06-29 09:52:34 -04:00
client.go os.Error API: don't export os.ErrorString, use os.NewError consistently 2011-06-22 10:52:47 -07:00
debug.go template: reverse order of arguments to Execute 2011-02-09 14:23:01 -08:00
Makefile build: no required environment variables 2010-08-18 10:08:49 -04:00
server_test.go os.Error API: don't export os.ErrorString, use os.NewError consistently 2011-06-22 10:52:47 -07:00
server.go strings.Split: make the default to split all. 2011-06-28 09:43:14 +10:00