Sweetohm

Michel Casabianca

En assistant à la dotGo, où le buzzword était clairement l’interface, je me suis demandé où l’on pouvait se procurer la liste de toutes les interfaces définies dans le langage. J’ai cherché et n’ai trouvé cette information nulle part.

Je me suis donc décidé à écrire un petit programme qui :

  • Télécharge le tarball des sources d’une version donnée.
  • Parse les fichiers sources pour en extraire les interfaces ainsi que le numéro de ligne où elles sont définies.
  • Affiche sur la console la liste de ces interfaces sous la forme d’un tableau markdown.

Le projet se trouve sur Github : https://github.com/c4s4/gointerfaces.

Voici le résultat :

Interface Package 1.0.3 1.1.2 1.2.2 1.3.3 1.4.3 1.5.4 1.6.3 1.7
AEAD crypto/cipher - - source source source source source source
Addr net source source source source source source source source
Addr vendor/golang_org/x/net/route - - - - - - - source
Auth net/smtp source source source source source source source source
BinaryMarshaler encoding - - source source source source source source
BinaryUnmarshaler encoding - - source source source source source source
Block crypto/cipher source source source source source source source source
BlockMode crypto/cipher source source source source source source source source
BufferPool net/http/httputil - - - - - - source source
ByteOrder encoding/binary source source source source source source source source
ByteReader io source source source source source source source source
ByteScanner io source source source source source source source source
ByteWriter io - source source source source source source source
ClientCodec net/rpc source source source source source source source source
ClientSessionCache crypto/tls - - - source source source source source
CloseNotifier net/http - source source source source source source source
Closer io source source source source source source source source
Color image/color source source source source source source source source
ColumnConverter database/sql/driver source source source source source source source source
Conn net source source source source source source source source
Conn database/sql/driver source source source source source source source source
Context context - - - - - - - source
CookieJar net/http source source source source source source source source
Curve crypto/elliptic source source source source source source source source
Decl go/ast source source source source source source source source
Decrypter crypto - - - - - source source source
DecrypterOpts crypto - - - - - source source source
Drawer image/draw - - source source source source source source
Driver database/sql/driver source source source source source source source source
Error net source source source source source source source source
Error runtime source source source source source source source source
Execer database/sql/driver source source source source source source source source
Expr go/ast source source source source source source source source
File net/http source source source source source source source source
File mime/multipart source source source source source source source source
FileInfo os source source source source source source source source
FileSystem net/http source source source source source source source source
Flusher net/http source source source source source source source source
Formatter fmt source source source source source source source source
Generator testing/quick source source source source source source source source
Getter flag - - source source source source source source
GoStringer fmt source source source source source source source source
GobDecoder encoding/gob source source source source source source source source
GobEncoder encoding/gob source source source source source source source source
Handler net/http source source source source source source source source
Hash hash source source source source source source source source
Hash32 hash source source source source source source source source
Hash64 hash source source source source source source source source
Hijacker net/http source source source source source source source source
Image image/draw source source source source source source source source
Image image source source source source source source source source
Importer go/types - - - - - source source source
ImporterFrom go/types - - - - - - source source
Interface container/heap source source source source source source source source
Interface sort source source source source source source source source
Listener net source source source source source source source source
Load debug/macho source source source source source source source source
Locker sync source source source source source source source source
Marshaler encoding/json source source source source source source source source
Marshaler encoding/xml - - source source source source source source
MarshalerAttr encoding/xml - - source source source source source source
Message vendor/golang_org/x/net/route - - - - - - - source
Model image/color source source source source source source source source
Node go/ast source source source source source source source source
Node text/template/parse source source source source source source source source
Object go/types - - - - - source source source
PacketConn net source source source source source source source source
PalettedImage image source source source source source source source source
PrivateKey crypto source source source source source source source source
PublicKey crypto - - source source source source source source
PublicSuffixList net/http/cookiejar - source source source source source source source
Quantizer image/draw - - source source source source source source
Queryer database/sql/driver - source source source source source source source
ReadCloser io source source source source source source source source
ReadSeeker io source source source source source source source source
ReadWriteCloser io source source source source source source source source
ReadWriteSeeker io source source source source source source source source
ReadWriter io source source source source source source source source
Reader io source source source source source source source source
Reader compress/flate source source source source source source source source
Reader image/jpeg source source source source source source source source
ReaderAt io source source source source source source source source
ReaderFrom io source source source source source source source source
Resetter compress/flate - - - - source source source source
Resetter compress/zlib - - - - source source source source
ResponseWriter net/http source source source source source source source source
Result database/sql source source source source source source source source
Result database/sql/driver source source source source source source source source
RoundTripper net/http source source source source source source source source
RoutingMessage syscall source source source source source source source source
Rows database/sql/driver source source source source source source source source
RuneReader io source source source source source source source source
RuneScanner io source source source source source source source source
ScanState fmt source source source source source source source source
Scanner database/sql source source source source source source source source
Scanner fmt source source source source source source source source
Seeker io source source source source source source source source
ServerCodec net/rpc source source source source source source source source
Signal os source source source source source source source source
Signer crypto - - - - source source source source
SignerOpts crypto - - - - source source source source
Sizes go/types - - - - - source source source
Sockaddr syscall source source source source source source source source
Source math/rand source source source source source source source source
State fmt source source source source source source source source
Stmt go/ast source source source source source source source source
Stmt database/sql/driver source source source source source source source source
Stream crypto/cipher source source source source source source source source
Stringer fmt source source source source source source source source
Sys vendor/golang_org/x/net/route - - - - - - - source
TB testing - - source source source source source source
TextMarshaler encoding - - source source source source source source
TextUnmarshaler encoding - - source source source source source source
Token encoding/json - - - - - source source source
Token encoding/xml source source source source source source source source
Tx database/sql/driver source source source source source source source source
Type reflect source source source source source source source source
Type go/types - - - - - source source source
Type debug/dwarf source source source source source source source source
Unmarshaler encoding/json source source source source source source source source
Unmarshaler encoding/xml - - source source source source source source
UnmarshalerAttr encoding/xml - - source source source source source source
Value flag source source source source source source source source
Value database/sql/driver source source source source source source source source
Value go/constant - - - - - source source source
ValueConverter database/sql/driver source source source source source source source source
Valuer database/sql/driver source source source source source source source source
Var expvar source source source source source source source source
Visitor go/ast source source source source source source source source
WriteCloser io source source source source source source source source
WriteSeeker io source source source source source source source source
Writer io source source source source source source source source
WriterAt io source source source source source source source source
WriterTo io source source source source source source source source

On pourra trouver une discussion sur ces interfaces dans l’article suivant (en anglais) : http://mwholt.blogspot.fr/2014/08/maximizing-use-of-interfaces-in-go.html.

Enjoy!