GO LEARNING PATH · 7 LESSONS
Interfaces
Implicit satisfaction, method sets, and the nil that is not nil.
The consumer declares the interface
Write the smallest interface a function needs, at the call site.
3 min · Worked lesson
Pointer receiver, pointer method set
Predict whether a value or only a pointer satisfies an interface.
3 min · Prediction challenge
A nil pointer in an interface is not a nil interface
Explain why err != nil can be true when the error is nil.
3 min · Prediction challenge
Asking an interface what it is holding
Read a value out of an interface without risking a panic.
3 min · Worked lesson
Embedding is not inheritance
Predict which method runs when an embedded type has one too.
3 min · Prediction challenge
fmt looks for String(), not a Stringer keyword
Make a type print itself as a dotted IPv4 address.
3 min · Worked lesson
any is interface{}, and it has no methods
Report the dynamic type of a value held in any.
3 min · Worked lesson