Reflection is a complicated topic that can't really be covered in a single recipe; however, a practical application of reflection is dealing with structure tags. At their core, struct tags are just key–value strings: you look up the key, then deal with the value. As you can imagine, for something like JSON marshaling and unmarshaling, there's a lot of complexity for dealing with these values.
The reflect package is designed for interrogating and understanding interface objects. It has helper methods to look at the different kinds of structures, values, struct tags, and more. If you need something beyond the basic interface conversion, such as the one at the beginning of this chapter, this is the package you should look at.
How to do it...
The following steps cover how to write and run your application:
- From your Terminal/console application,createa new directory called~/projects...