August 2019
Beginner to intermediate
798 pages
17h 2m
English
This section will present you with a relatively simple reflection example in order to help you to feel comfortable with this advanced Go feature.
The name of the Go source file is reflection.go and it will be presented to you in four parts. The purpose of reflection.go is to examine an "unknown" structure variable and find out more about it at runtime. In order to be more interesting, the program will define two new struct types. Based on these two types, it will also define two new variables; however, it will only examine one of them.
If the program has no command-line arguments, it will examine the first one, otherwise it will explore the second one – practically, this means that the program will not know in ...
Read now
Unlock full access