Say that you want a function which returns a Reader:
type ReaderMaker func() io.Reader
A function which returns a concrete type which implements Reader cannot be substituted. This makes sense because interface types are always a two-word tuple, and a concrete type could be a one-word pointer, a big struct, etc. var invalid ReaderMaker = func() *io.PipeReader { return &io.PipeReader{} }
More subtly, a function which returns a different but compatible interface type also won't work. // This assignment is invalid because although anything that implements
// ReadCloser also implements Reader, a ReadCloser itable won't necessarily
// have Read() at the same offset as a Reader itable.
var invalid ReaderMaker = func() io.ReadCloser { return &io.PipeReader{} }
http://play.golang.org/p/5PPpVZhap_* edit: fixed swapped types in comment