-
Notifications
You must be signed in to change notification settings - Fork 0
Well known struct tags
Go offers struct tags which are discoverable via reflection. These enjoy a wide range of use in the standard library in the JSON/XML and other encoding packages. The community welcomed them and build ORMs, further encodings, flag parsers and much more around them.
Since esp. while handling encodings and ORMs single sourcing data structures is beneficial for data structures.
Due to increased usage of Go and thus Go struct tags, clashes become inevitable.
The list below is a best effort to document well known struct tags used by packages which available to the public.
- Struct tag as extracted by calling https://godoc.org/reflect#StructTag.Get with this tag as the
key
argument. - Documentation link of this package using https://godoc.org
Tag | Documentation |
---|---|
xml | https://godoc.org/encoding/xml |
List entries can be added by anyone who creates a public package where a new tag is used. List entries can be removed when the links to the package documentation stops working or the author(s) of that package requests it.
Tag | Documentation |
---|---|
xml | https://godoc.org/encoding/xml |
json | https://godoc.org/encoding/json |
asn1 | https://godoc.org/encoding/asn1 |
- Home
- Getting started with Go
- Working with Go
- Learning more about Go
- The Go Community
- Using the Go toolchain
- Additional Go Programming Wikis
- Online Services that work with Go
- Troubleshooting Go Programs in Production
- Contributing to the Go Project
- Platform Specific Information
- Release Specific Information