AlgoMaster Logo

reflect.Type and reflect.Value

Last Updated: May 22, 2026

Medium Priority
8 min read

The reflect package gives you two handles on any Go value: a reflect.Type that describes what the value is, and a reflect.Value that wraps the value itself. Almost every reflection program is some combination of producing these two things, asking them questions, and either reading or writing through them. This chapter covers how reflect.TypeOf and reflect.ValueOf work, how Kind differs from Type, how to read primitive and container values, and the rules that decide whether you can write back through a Value.

Premium Content

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