← Course map

GO LEARNING PATH · 7 LESSONS

Interfaces

Implicit satisfaction, method sets, and the nil that is not nil.

  1. The consumer declares the interface

    Write the smallest interface a function needs, at the call site.

    3 min · Worked lesson

  2. Pointer receiver, pointer method set

    Predict whether a value or only a pointer satisfies an interface.

    3 min · Prediction challenge

  3. 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

  4. Asking an interface what it is holding

    Read a value out of an interface without risking a panic.

    3 min · Worked lesson

  5. Embedding is not inheritance

    Predict which method runs when an embedded type has one too.

    3 min · Prediction challenge

  6. fmt looks for String(), not a Stringer keyword

    Make a type print itself as a dotted IPv4 address.

    3 min · Worked lesson

  7. any is interface{}, and it has no methods

    Report the dynamic type of a value held in any.

    3 min · Worked lesson