title: Well-known struct tags

Background

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 has built ORMs, further encodings, flag parsers and much more around them since, especially for these tasks, single-sourcing is beneficial for data structures.

Problem description

Due to increased usage of Go and thus Go struct tags, clashes become inevitable.

Solution

The list below is a best effort to document well-known struct tags used by packages which are available to the public.

Format of the list

Example entry

TagDocumentation
xmlhttps://pkg.go.dev/encoding/xml

Change Management

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.

List of well-known struct tags

TagDocumentation
xmlhttps://pkg.go.dev/encoding/xml
jsonhttps://pkg.go.dev/encoding/json
asn1https://pkg.go.dev/encoding/asn1
reformhttps://pkg.go.dev/gopkg.in/reform.v1
dynamodbavhttps://docs.aws.amazon.com/sdk-for-go/api/service/dynamodb/dynamodbattribute/#Marshal
bigqueryhttps://pkg.go.dev/cloud.google.com/go/bigquery
datastorehttps://pkg.go.dev/cloud.google.com/go/datastore
spannerhttps://pkg.go.dev/cloud.google.com/go/spanner
bsonhttps://pkg.go.dev/go.mongodb.org/mongo-driver/bson
gormhttps://pkg.go.dev/github.com/jinzhu/gorm
yamlhttps://pkg.go.dev/gopkg.in/yaml.v2
tomlhttps://pkg.go.dev/github.com/pelletier/go-toml
validatehttps://github.com/go-playground/validator
mapstructurehttps://pkg.go.dev/github.com/mitchellh/mapstructure
parserhttps://pkg.go.dev/github.com/alecthomas/participle
protobufhttps://github.com/golang/protobuf
dbhttps://github.com/jmoiron/sqlx
urlhttps://github.com/google/go-querystring
featurehttps://github.com/nikolaydubina/go-featureprocessing
graphqlhttps://github.com/samsarahq/thunder
egghttps://github.com/andrewwphillips/eggql
cuehttps://pkg.go.dev/cuelang.org/go/cuego