This is a creation in Article, where the information may have evolved or changed.
package main // defines an interface// has two methods// Note: Methods cannot be added functype ifile interface { Read (file string) (buf []byte) Write (file string, buf []byte)}type ireader interface {read (file string) (buf []byte)}type iwriter interface { Write (File string, buf []byte)}// defines a struct// by the method defined below:// file also implements IFile ireader iwriter all the methods// so File implementation ifile also implemented Ireader and iwritertype file struct Methods in {}// structure func (f *file) read (file string) (buf []byte) {return Methods in the nil}// structure func (f *file) write (file string, buf []byte) {} Func main () {f := new (File)// file also implements Ifile ireader iwriter all methods// So the file implements the ifile also implements the Ireader and iwriter// so these transitions are grammatically consistent var f1 ifile = fvar f2 ireader = fvar F3 iwriter = ff. Read ("AA") F1. Read ("BB") F2. Read ("CC")// iwriter only defined the Write method F3.write ("DD", []byte {1,2})}