TryBugHunt

Go interface exercises

Go interfaces are satisfied implicitly, but the 'typed nil' trap is infamous: an interface value is only nil if both its type and value are nil. Storing a nil concrete pointer inside an interface makes it non-nil, passing nil checks and panicking later.

Master Go interface semantics and pointer receivers through real debugging challenges.

See the 6 exercisesOr follow the 30-day path

The interfaces bugs you will meet

The exercises

Errors you might be searching for

More JavaScript practice by topic

Questions

Why is (interface)(nil) != (concrete)(nil)?

An interface in Go holds two 64-bit words: a type descriptor pointer and a data pointer. If the type is set, the interface itself is not nil.