blob: a78bf04b3c96002044ea033f5b3fcc1cb9760597 [file] [log] [blame] [view]
johnl7b3f1262017-01-28 21:00:38 +01001# Well-known struct tags
Ingo Oesera4e3bbb2016-08-16 17:57:15 +02002## Background
3
johnl7b3f1262017-01-28 21:00:38 +01004Go offers [struct tags](https://golang.org/ref/spec#Tag) which are discoverable via reflection. These enjoy a wide range of use in the standard library in the JSON/XML and other encoding packages.
Ingo Oesera4e3bbb2016-08-16 17:57:15 +02005
johnl7b3f1262017-01-28 21:00:38 +01006The community welcomed them and has built ORMs, further encodings, flag parsers and much more around them since, especially for these tasks, single-sourcing is beneficial for data structures.
Ingo Oesera4e3bbb2016-08-16 17:57:15 +02007
8## Problem description
9Due to increased usage of Go and thus Go [struct tags](https://golang.org/ref/spec#Tag), clashes become inevitable.
10
11## Solution
johnl7b3f1262017-01-28 21:00:38 +010012The list below is a best effort to document well-known struct tags used by packages which are available to the public.
Ingo Oesera4e3bbb2016-08-16 17:57:15 +020013
14## Format of the list
15* Struct tag as extracted by calling https://godoc.org/reflect#StructTag.Get with this tag as the `key` argument.
16* Documentation link of this package using https://godoc.org
17
18### Example entry
19Tag | Documentation
20----|-----
21xml | https://godoc.org/encoding/xml
22
23### Change Management
24List entries can be added by anyone who creates a public package where a new tag is used.
25List entries can be removed when the links to the package documentation stops working or the author(s) of that package requests it.
26
johnl7b3f1262017-01-28 21:00:38 +010027## List of well-known struct tags
Alexey Palazhchenkofa3cf3e2017-01-25 18:35:15 +030028Tag | Documentation
29-------|-----
30xml | https://godoc.org/encoding/xml
31json | https://godoc.org/encoding/json
32asn1 | https://godoc.org/encoding/asn1
33reform | https://godoc.org/gopkg.in/reform.v1