Reflection in Go is a form of metaprogramming. Using reflection in Go lets the program understand its own structure. There are times when you want to use a variable at runtime that doesn't exist when the program was composed. We use reflection to check the key and value pair that is stored within an interface variable. Reflection is not often clear, so be wary of using it—it should be used in special cases when necessary. It only has runtime checks (not compile checks), so we need to use reflection with common sense.
It's important to remember that Go's variables are statically typed. There are many different variable types that we can use in Go—rune, int, string, and so on. We can declare a specific type as follows:
Type foo int
var x int
var y foo
Both variables, x and y, will be int typed variables.
There are three important...