go-interfaces-embedding
Installation
SKILL.md
Go Interfaces & Embedding
Interface satisfaction is implicit and structural. Embedding promotes the inner type's method set; the receiver stays the inner type. Composition, not inheritance — no virtual dispatch.
Type switch vs assertion
switch t := v.(type) {
case int: use(t) // t is int
case *Foo: use(t) // t is *Foo
default: // t keeps interface type
}
s, ok := v.(string) // comma-ok avoids panic
Bare v.(string) panics on mismatch.