Go implements interfaces using a two-word structure containing a pointer to an itab (interface table) and a pointer to the concrete data. The itab is a runtime-allocated structure that maps the interface's method set to the concrete type's method implementations, allowing the runtime to resolve method calls dynamically. When a concrete type is assigned to an interface, the runtime checks if an itab exists for that type-interface pair; if not, it creates one and caches it for future lookups.
// Conceptual layout of a non-empty interface value
// (Actual implementation is in runtime/iface.go)
type itab struct {
inter *interfacetype // Interface definition
_type *_type // Concrete type definition
hash uint32 // Type hash for equality checks
bad bool // True if type does not implement interface
inited uint32 // Initialization flag
link *itab // Linked list for iteration
tptr unsafe.Pointer // Pointer to concrete type data
// Method pointers follow here...
}
// Interface value structure (non-empty interface)
type iface struct {
itab *itab // Pointer to the interface table
data unsafe.Pointer // Pointer to the concrete value
}