Skip to content

Instantly share code, notes, and snippets.

@tysonmote
Created January 22, 2018 22:51
Show Gist options
  • Save tysonmote/a2736bf550fe897b60ca53dda5c15807 to your computer and use it in GitHub Desktop.
Save tysonmote/a2736bf550fe897b60ca53dda5c15807 to your computer and use it in GitHub Desktop.

Config through public attributes on struct

  • exec.Cmd
  • http.Client
  • http.Server
  • net.Client
  • net.Server

Config through NewFoo() only

  • bufio.Reader
    • func NewReader(rd io.Reader) *Reader
    • func NewReaderSize(rd io.Reader, size int) *Reader
  • bufio.Scanner
    • func NewScanner(r io.Reader) *Scanner
  • bufio.Writer
    • func NewWriter(w io.Writer) *Writer
  • bytes.Buffer
    • func NewBuffer(buf []byte) *Buffer
    • func NewBufferString(s string) *Buffer
  • gzip.Reader
    • func NewReader(r io.Reader) (*Reader, error)
  • gzip.Writer
    • func NewWriter(w io.Writer) *Writer
    • func NewWriterLevel(w io.Writer, level int) (*Writer, error)
  • json.Decoder
    • func NewDecoder(r io.Reader) *Decoder
  • json.Encoder
    • func NewEncoder(w io.Writer) *Encoder
  • log.Logger
    • func New(out io.Writer, prefix string, flag int) *Logger
  • net.ServeMux
    • func NewServeMux() *ServeMux
  • rpc.Client
    • func Dial(network, address string) (*Client, error)
    • func DialHTTP(network, address string) (*Client, error)
    • func DialHTTPPath(network, address, path string) (*Client, error)
    • func NewClient(conn io.ReadWriteCloser) *Client
    • func NewClientWithCodec(codec ClientCodec) *Client
  • sql.DB
    • func Open(driverName, dataSourceName string) (*DB, error)

Config through NewFoo() and public attributes

  • net.Request
    • NewRequest(method, urlStr string, body io.Reader) (*Request, error))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment