Essential Go Basic types  Suggest an edit

Interfaces

An interface defines a set of methods on a struct.

Zero value of interface is nil.

Here’s the definition of the io.Reader interface from the standard library:

type Reader interface {
    Read(p []byte) (n int, err error)
}

The smaller the interface, the better.

Learn more about interfaces.

  ↑ ↓ to navigate     ↵ to select     Esc to close