Explore the versatile applications of struct tags in Go through this 22-minute conference talk from GopherCon 2015. Delve into practical and unconventional uses of this underutilized feature, including object-relational mapping, validation functions, middleware definition, and command-line options. Learn about namespacing, serialization, tag safety, and the potential for code generation with struct tags. Gain insights into clever implementations like the MustHave tag and unusual mapping cases, as well as their role in handling default values and type validation. Discover how struct tags can enhance your Go programming beyond common JSON and XML field specifications.
Overview
Syllabus
Intro
Why are we here?
What we've built
What is a struct tag?
Why?
Namespacing
Serialization
Tag Safety
MustHave Tag
A More Unusual Mapping Case
Command-line Configuration
Default Values
How About Type Validation?
Foreign Languages
The Future: Code Generation?
Taught by
Gopher Academy