In this chapter, I describe the Go support for reflection, which allows an application to work with types that are not known when the project is compiled, which is useful for creating APIs that will be used by other projects, for example. You can see extensive use of reflection in Part 3, where I create a custom web application framework. In this situation, the code in the application framework doesn’t know anything about the data types that will be defined by the applications it is used to run and has to use reflection to get information about those ...
27. Using Reflection
Get Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.