Back to course

Reflection: When to Use (and Avoid) It

Go (Golang) for Cloud-Native Microservices

Understanding Reflect

Reflection allows a program to inspect its own types at runtime. This is how json.Marshal works.

Warning: Reflection is slow and bypasses type safety. Use it only when building generic tools or libraries. For microservices, prefer explicit code.