Tag

empty interface

0 views collected around this technical thread.

Raymond Ops
Raymond Ops
Mar 19, 2025 · Fundamentals

Unlocking Go’s Empty Interface: How Any Type Becomes a Value

This article explains Go’s empty interface, showing how it can hold values of any type, how to declare and use it in functions and data structures, and why copying between concrete slices and empty‑interface slices requires element‑wise assignment due to its two‑word memory layout.

Goempty interfaceinterface{}
0 likes · 5 min read
Unlocking Go’s Empty Interface: How Any Type Becomes a Value