Essential Go Basic types  Edit on GitHub      File Issue


An interface defines a set of methods on a struct.

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.

Zero value of interace is nil

Learn more about interfaces.

  ↑ ↓ to navigate     ↵ to select     Esc to close