Skip to content

Instantly share code, notes, and snippets.

@mholt mholt/everything.go
Last active May 9, 2018

Embed
What would you like to do?
Implements 103 of the 114 Go 1.3 standard library interfaces
package interfaces
import (
"bufio"
"crypto/elliptic"
"crypto/tls"
"database/sql/driver"
"debug/dwarf"
"encoding/xml"
"fmt"
"go/ast"
"go/token"
"image"
"image/color"
"image/draw"
"io"
"math/big"
"math/rand"
"net"
"net/http"
"net/rpc"
"net/smtp"
"net/url"
"os"
"reflect"
"text/template/parse"
"time"
)
// Everything satisfies 103 of the 114 Go standard library interfaces.
// Some interfaces had functions overlap in both name and signature,
// conveniently satisfying both while implementing just one. Some could
// not be satisfied because a method name was the same, but the signature
// was different. Thus, these interfaces are not satisfied:
// http://golang.org/pkg/crypto/cipher/#AEAD
// http://golang.org/pkg/database/sql/driver/#Stmt
// http://golang.org/pkg/crypto/tls/#ClientSessionCache
// http://golang.org/pkg/fmt/#Scanner
// http://golang.org/pkg/reflect/#Type
// http://golang.org/pkg/hash/#Hash
// http://golang.org/pkg/image/draw/#Image
// http://golang.org/pkg/net/http/#FileSystem
// http://golang.org/pkg/net/smtp/#Auth
// http://golang.org/pkg/testing/#TB
// Of course, this type does nothing and serves no purpose. Don't use it.
type Everything struct{}
// http://golang.org/pkg/builtin/#error
func (e Everything) Error() string {
return ""
}
// http://golang.org/pkg/container/heap/#Interface
func (e Everything) Push(x interface{}) {
}
func (e Everything) Pop() interface{} {
return nil
}
// http://golang.org/pkg/crypto/cipher/#AEAD
func (e Everything) NonceSize() int {
return 0
}
func (e Everything) Overhead() int {
return 0
}
func (e Everything) Seal(dst, nonce, plaintext, data []byte) []byte {
return []byte{}
}
/*func (e Everything) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) {
return []byte{}, nil
}*/
// http://golang.org/pkg/crypto/cipher/#Block
func (e Everything) BlockSize() int {
return 0
}
func (e Everything) Encrypt(dst, src []byte) {
}
func (e Everything) Decrypt(dst, src []byte) {
}
// http://golang.org/pkg/crypto/cipher/#BlockMode
func (e Everything) CryptBlocks(dst, src []byte) {
}
// http://golang.org/pkg/crypto/cipher/#Stream
func (e Everything) XORKeyStream(dst, src []byte) {
}
// http://golang.org/pkg/crypto/elliptic/#Curve
func (e Everything) Params() *elliptic.CurveParams {
return nil
}
func (e Everything) IsOnCurve(x, y *big.Int) bool {
return false
}
func (e Everything) Add(x1, y1, x2, y2 *big.Int) (x, y *big.Int) {
return nil, nil
}
func (e Everything) Double(x1, y1 *big.Int) (x, y *big.Int) {
return nil, nil
}
func (e Everything) ScalarMult(x1, y1 *big.Int, k []byte) (x, y *big.Int) {
return nil, nil
}
func (e Everything) ScalarBaseMult(k []byte) (x, y *big.Int) {
return nil, nil
}
// http://golang.org/pkg/crypto/tls/#ClientSessionCache
/*func (e Everything) Get(sessionKey string) (session *tls.ClientSessionState, ok bool) {
return nil, false
}*/
func (e Everything) Put(sessionKey string, cs *tls.ClientSessionState) {
}
// http://golang.org/pkg/database/sql/#Result
func (e Everything) LastInsertId() (int64, error) {
return 0, nil
}
func (e Everything) RowsAffected() (int64, error) {
return 0, nil
}
// http://golang.org/pkg/database/sql/#Scanner
func (e Everything) Scan(src interface{}) error {
return nil
}
// http://golang.org/pkg/database/sql/driver/#ColumnConverter
func (e Everything) ColumnConverter(idx int) driver.ValueConverter {
return nil
}
// http://golang.org/pkg/database/sql/driver/#Conn
func (e Everything) Prepare(query string) (driver.Stmt, error) {
return nil, nil
}
func (e Everything) Begin() (driver.Tx, error) {
return nil, nil
}
// http://golang.org/pkg/database/sql/driver/#Driver
func (e Everything) Open(name string) (driver.Conn, error) {
return nil, nil
}
// http://golang.org/pkg/database/sql/driver/#Execer
func (e Everything) Exec(query string, args []driver.Value) (driver.Result, error) {
return nil, nil
}
// http://golang.org/pkg/database/sql/driver/#Queryer
func (e Everything) Query(query string, args []driver.Value) (driver.Rows, error) {
return nil, nil
}
// http://golang.org/pkg/database/sql/driver/#Rows
func (e Everything) Columns() []string {
return []string{}
}
func (e Everything) Next(dest []driver.Value) error {
return nil
}
// http://golang.org/pkg/database/sql/driver/#Stmt
func (e Everything) NumInput() int {
return 0
}
/*func (e Everything) Exec(args []Value) (Result, error) {
return sql.Result{}, nil
}
func (e Everything) Query(args []Value) (Rows, error) {
return sql.Rows{}, nil
}*/
// http://golang.org/pkg/database/sql/driver/#Tx
func (e Everything) Commit() error {
return nil
}
func (e Everything) Rollback() error {
return nil
}
// http://golang.org/pkg/database/sql/driver/#ValueConverter
func (e Everything) ConvertValue(v interface{}) (driver.Value, error) {
return nil, nil
}
// http://golang.org/pkg/database/sql/driver/#Valuer
func (e Everything) Value() (driver.Value, error) {
return nil, nil
}
// http://golang.org/pkg/debug/dwarf/#Type
func (e Everything) Common() *dwarf.CommonType {
return nil
}
// http://golang.org/pkg/debug/macho/#Load
func (e Everything) Raw() []byte {
return []byte{}
}
// http://golang.org/pkg/encoding/#BinaryMarshaler
func (e Everything) MarshalBinary() (data []byte, err error) {
return data, err
}
// http://golang.org/pkg/encoding/#BinaryUnmarshaler
func (e Everything) UnmarshalBinary(data []byte) error {
return nil
}
// http://golang.org/pkg/encoding/#TextMarshaler
func (e Everything) MarshalText() (text []byte, err error) {
return text, err
}
// http://golang.org/pkg/encoding/#TextUnmarshaler
func (e Everything) UnmarshalText(text []byte) error {
return nil
}
// http://golang.org/pkg/encoding/binary/#ByteOrder
func (e Everything) Uint16([]byte) uint16 {
return 0
}
func (e Everything) Uint32([]byte) uint32 {
return 0
}
func (e Everything) Uint64([]byte) uint64 {
return 0
}
func (e Everything) PutUint16([]byte, uint16) {
}
func (e Everything) PutUint32([]byte, uint32) {
}
func (e Everything) PutUint64([]byte, uint64) {
}
// http://golang.org/pkg/encoding/gob/#GobDecoder
func (e Everything) GobDecode([]byte) error {
return nil
}
// http://golang.org/pkg/encoding/gob/#GobEncoder
func (e Everything) GobEncode() ([]byte, error) {
return []byte{}, nil
}
// http://golang.org/pkg/encoding/json/#Marshaler
func (e Everything) MarshalJSON() ([]byte, error) {
return []byte{}, nil
}
// http://golang.org/pkg/encoding/json/#Unmarshaler
func (e Everything) UnmarshalJSON([]byte) error {
return nil
}
// http://golang.org/pkg/encoding/xml/#Marshaler
func (ev Everything) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
return nil
}
// http://golang.org/pkg/encoding/xml/#MarshalerAttr
func (e Everything) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
return xml.Attr{}, nil
}
// http://golang.org/pkg/encoding/xml/#Unmarshaler
func (e Everything) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
return nil
}
// http://golang.org/pkg/encoding/xml/#UnmarshalerAttr
func (e Everything) UnmarshalXMLAttr(attr xml.Attr) error {
return nil
}
// http://golang.org/pkg/flag/#Getter
func (e Everything) Get() interface{} {
return nil
}
// http://golang.org/pkg/flag/#Value
func (e Everything) Set(string) error {
return nil
}
// http://golang.org/pkg/fmt/#Formatter
func (e Everything) Format(f fmt.State, c rune) {
}
// http://golang.org/pkg/fmt/#GoStringer
func (e Everything) GoString() string {
return ""
}
// http://golang.org/pkg/fmt/#ScanState
func (e Everything) SkipSpace() {
}
func (e Everything) Token(skipSpace bool, f func(rune) bool) (token []byte, err error) {
return token, err
}
func (e Everything) Width() (wid int, ok bool) {
return wid, ok
}
// http://golang.org/pkg/fmt/#Scanner
/*func (e Everything) Scan(state ScanState, verb rune) error {
return
}*/
// http://golang.org/pkg/fmt/#State
func (e Everything) Precision() (prec int, ok bool) {
return prec, ok
}
func (e Everything) Flag(c int) bool {
return false
}
// http://golang.org/pkg/fmt/#Stringer
func (e Everything) String() string {
return ""
}
// http://golang.org/pkg/go/ast/#Node
func (e Everything) Pos() token.Pos {
return 0
}
func (e Everything) End() token.Pos {
return 0
}
// http://golang.org/pkg/go/ast/#Visitor
func (e Everything) Visit(node ast.Node) (w ast.Visitor) {
return w
}
// http://golang.org/pkg/hash/#Hash
func (e Everything) Sum(b []byte) []byte {
return []byte{}
}
func (e Everything) Reset() {
}
/*func (e Everything) Size() int {
return 0
}
func (e Everything) BlockSize() int {
return 0
}*/
// http://golang.org/pkg/hash/#Hash32
func (e Everything) Sum32() uint32 {
return 0
}
// http://golang.org/pkg/hash/#Hash64
func (e Everything) Sum64() uint64 {
return 0
}
// http://golang.org/pkg/image/#Image
func (e Everything) ColorModel() color.Model {
return nil
}
func (e Everything) Bounds() image.Rectangle {
return image.Rectangle{}
}
func (e Everything) At(x, y int) color.Color {
return nil
}
// http://golang.org/pkg/image/#PalettedImage
func (e Everything) ColorIndexAt(x, y int) uint8 {
return 0
}
// http://golang.org/pkg/image/color/#Color
func (e Everything) RGBA() (r, g, b, a uint32) {
return r, g, b, a
}
// http://golang.org/pkg/image/color/#Model
func (e Everything) Convert(c color.Color) color.Color {
return nil
}
// http://golang.org/pkg/image/draw/#Drawer
func (e Everything) Draw(dst draw.Image, r image.Rectangle, src image.Image, sp image.Point) {
}
// http://golang.org/pkg/image/draw/#Image
/*func (e Everything) Set(x, y int, c color.Color) {
}*/
// http://golang.org/pkg/image/draw/#Quantizer
func (e Everything) Quantize(p color.Palette, m image.Image) color.Palette {
return color.Palette{}
}
// http://golang.org/pkg/io/#ByteReader
func (e Everything) ReadByte() (c byte, err error) {
return c, err
}
// http://golang.org/pkg/io/#ByteScanner
func (e Everything) UnreadByte() error {
return nil
}
// http://golang.org/pkg/io/#ByteWriter
func (e Everything) WriteByte(c byte) error {
return nil
}
// http://golang.org/pkg/io/#Closer
func (e Everything) Close() error {
return nil
}
// http://golang.org/pkg/io/#Reader
func (e Everything) Read(p []byte) (n int, err error) {
return n, err
}
// http://golang.org/pkg/io/#ReaderAt
func (e Everything) ReadAt(p []byte, off int64) (n int, err error) {
return n, err
}
// http://golang.org/pkg/io/#ReaderFrom
func (e Everything) ReadFrom(r io.Reader) (n int64, err error) {
return n, err
}
// http://golang.org/pkg/io/#RuneReader
func (e Everything) ReadRune() (r rune, size int, err error) {
return r, size, err
}
// http://golang.org/pkg/io/#RuneScanner
func (e Everything) UnreadRune() error {
return nil
}
// http://golang.org/pkg/io/#Seeker
func (e Everything) Seek(offset int64, whence int) (int64, error) {
return 0, nil
}
// http://golang.org/pkg/io/#Writer
func (e Everything) Write(p []byte) (n int, err error) {
return n, nil
}
// http://golang.org/pkg/io/#WriterAt
func (e Everything) WriteAt(p []byte, off int64) (n int, err error) {
return n, err
}
// http://golang.org/pkg/io/#WriterTo
func (e Everything) WriteTo(w io.Writer) (n int64, err error) {
return n, err
}
// http://golang.org/pkg/math/rand/#Source
// Kind of funny reason for this name: https://groups.google.com/forum/#!topic/golang-nuts/Kle874lT1Eo/discussion
func (e Everything) Int63() int64 {
return 0
}
func (e Everything) Seed(seed int64) {
}
// http://golang.org/pkg/net/#Addr
func (e Everything) Network() string {
return ""
}
// http://golang.org/pkg/net/#Conn
func (e Everything) LocalAddr() net.Addr {
return nil
}
func (e Everything) RemoteAddr() net.Addr {
return nil
}
func (e Everything) SetDeadline(t time.Time) error {
return nil
}
func (e Everything) SetReadDeadline(t time.Time) error {
return nil
}
func (e Everything) SetWriteDeadline(t time.Time) error {
return nil
}
// http://golang.org/pkg/net/#Error
func (e Everything) Timeout() bool {
return false
}
func (e Everything) Temporary() bool {
return false
}
// http://golang.org/pkg/net/#Listener
func (e Everything) Accept() (c net.Conn, err error) {
return c, err
}
func (e Everything) Addr() net.Addr {
return nil
}
// http://golang.org/pkg/net/http/#CloseNotifier
func (e Everything) CloseNotify() <-chan bool {
return make(<-chan bool)
}
// http://golang.org/pkg/net/http/#CookieJar
func (e Everything) SetCookies(u *url.URL, cookies []*http.Cookie) {
}
func (e Everything) Cookies(u *url.URL) []*http.Cookie {
return []*http.Cookie{}
}
// http://golang.org/pkg/net/http/#File
func (e Everything) Readdir(count int) ([]os.FileInfo, error) {
return []os.FileInfo{}, nil
}
func (e Everything) Stat() (os.FileInfo, error) {
return nil, nil
}
// http://golang.org/pkg/net/http/#FileSystem
/*func (e Everything) Open(name string) (http.File, error) {
return nil, nil
}*/
// http://golang.org/pkg/net/http/#Flusher
func (e Everything) Flush() {
}
// http://golang.org/pkg/net/http/#Handler
func (e Everything) ServeHTTP(http.ResponseWriter, *http.Request) {
}
// http://golang.org/pkg/net/http/#Hijacker
func (e Everything) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return nil, nil, nil
}
// http://golang.org/pkg/net/http/#ResponseWriter
func (e Everything) Header() http.Header {
return nil
}
func (e Everything) WriteHeader(int) {
}
// http://golang.org/pkg/net/http/#RoundTripper
func (e Everything) RoundTrip(*http.Request) (*http.Response, error) {
return nil, nil
}
// http://golang.org/pkg/net/http/cookiejar/#PublicSuffixList
func (e Everything) PublicSuffix(domain string) string {
return ""
}
// http://golang.org/pkg/net/rpc/#ClientCodec
func (e Everything) WriteRequest(*rpc.Request, interface{}) error {
return nil
}
func (e Everything) ReadResponseHeader(*rpc.Response) error {
return nil
}
func (e Everything) ReadResponseBody(interface{}) error {
return nil
}
// http://golang.org/pkg/net/rpc/#ServerCodec
func (e Everything) ReadRequestHeader(*rpc.Request) error {
return nil
}
func (e Everything) ReadRequestBody(interface{}) error {
return nil
}
func (e Everything) WriteResponse(*rpc.Response, interface{}) error {
return nil
}
// http://golang.org/pkg/net/smtp/#Auth
func (e Everything) Start(server *smtp.ServerInfo) (proto string, toServer []byte, err error) {
return "", []byte{}, nil
}
/*func (e Everything) Next(fromServer []byte, more bool) (toServer []byte, err error) {
return toServer, err
}*/
// http://golang.org/pkg/os/#FileInfo
func (e Everything) Name() string {
return ""
}
func (e Everything) Size() int64 {
return 0
}
func (e Everything) Mode() os.FileMode {
return 0
}
func (e Everything) ModTime() time.Time {
return time.Time{}
}
func (e Everything) IsDir() bool {
return false
}
func (e Everything) Sys() interface{} {
return nil
}
// http://golang.org/pkg/os/#Signal
func (e Everything) Signal() {
}
// http://golang.org/pkg/reflect/#Type
func (e Everything) Align() int {
return 0
}
func (e Everything) FieldAlign() int {
return 0
}
func (e Everything) Method(int) reflect.Method {
return reflect.Method{}
}
func (e Everything) MethodByName(string) (reflect.Method, bool) {
return reflect.Method{}, false
}
func (e Everything) NumMethod() int {
return 0
}
func (e Everything) PkgPath() string {
return ""
}
/*func (e Everything) Size() uintptr {
return 0
}*/
func (e Everything) Kind() reflect.Kind {
return 0
}
func (e Everything) Implements(u reflect.Type) bool {
return false
}
func (e Everything) AssignableTo(u reflect.Type) bool {
return false
}
func (e Everything) ConvertibleTo(u reflect.Type) bool {
return false
}
func (e Everything) Bits() int {
return 0
}
func (e Everything) ChanDir() reflect.ChanDir {
return 0
}
func (e Everything) IsVariadic() bool {
return false
}
func (e Everything) Elem() reflect.Type {
return nil
}
func (e Everything) Field(i int) reflect.StructField {
return reflect.StructField{}
}
func (e Everything) FieldByIndex(index []int) reflect.StructField {
return reflect.StructField{}
}
func (e Everything) FieldByName(name string) (reflect.StructField, bool) {
return reflect.StructField{}, false
}
func (e Everything) FieldByNameFunc(match func(string) bool) (reflect.StructField, bool) {
return reflect.StructField{}, false
}
func (e Everything) In(i int) reflect.Type {
return nil
}
func (e Everything) Key() reflect.Type {
return nil
}
func (e Everything) NumField() int {
return 0
}
func (e Everything) NumIn() int {
return 0
}
func (e Everything) NumOut() int {
return 0
}
func (e Everything) Out(i int) reflect.Type {
return nil
}
// http://golang.org/pkg/runtime/#Error
func (e Everything) RuntimeError() {
return
}
// http://golang.org/pkg/sort/#Interface
func (e Everything) Len() int {
return 0
}
func (e Everything) Less(i, j int) bool {
return false
}
func (e Everything) Swap(i, j int) {
}
// http://golang.org/pkg/sync/#Locker
func (e Everything) Lock() {
}
func (e Everything) Unlock() {
}
// http://golang.org/pkg/testing/#TB
/*func (e Everything) Error(args ...interface{}) {
}*/
func (e Everything) Errorf(format string, args ...interface{}) {
}
func (e Everything) Fail() {
}
func (e Everything) FailNow() {
}
func (e Everything) Failed() bool {
return false
}
func (e Everything) Fatal(args ...interface{}) {
}
func (e Everything) Fatalf(format string, args ...interface{}) {
}
func (e Everything) Log(args ...interface{}) {
}
func (e Everything) Logf(format string, args ...interface{}) {
}
func (e Everything) Skip(args ...interface{}) {
}
func (e Everything) SkipNow() {
}
func (e Everything) Skipf(format string, args ...interface{}) {
}
func (e Everything) Skipped() bool {
return false
}
// http://golang.org/pkg/testing/quick/#Generator
func (e Everything) Generate(rand *rand.Rand, size int) reflect.Value {
return reflect.Value{}
}
// http://golang.org/pkg/text/template/parse/#Node
func (e Everything) Type() parse.NodeType {
return 0
}
func (e Everything) Copy() parse.Node {
return nil
}
func (e Everything) Position() parse.Pos {
return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.