Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

The Many Faces of Struct Tags

Gopher Academy via YouTube

Overview

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.

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

Reviews

Start your review of The Many Faces of Struct Tags

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.