AlgoMaster Logo

Inspecting Structs

Medium Priority16 min readUpdated June 6, 2026

Reflection on plain values shows what kind of thing you're holding, but most real reflection work happens against structs: pulling field names for a SQL row mapper, dumping a config for a debug endpoint, or writing a generic JSON-like serializer. This chapter walks through the API the reflect package exposes for that: how to iterate fields, how to read each field's metadata, how to read and write field values, and how Go's export rules constrain what you can do with unexported fields.

Premium Content

Subscribe to unlock full access to this content and more premium articles.