identify.go
func (c Identify) Write(w *bufio.Writer) (err error) {
	var data []byte

	if data, err = json.Marshal(identifyBody{
		ClientID:       c.ClientID,
		Hostname:       c.Hostname,
		UserAgent:      c.UserAgent,
		MessageTimeout: int(c.MessageTimeout / time.Millisecond),
	}); err != nil {
		return
	}

	if _, err = w.WriteString("IDENTIFY\n"); err != nil {
		err = errors.Wrap(err, "writing IDENTIFY command")
		return
	}

	if err = binary.Write(w, binary.BigEndian, uint32(len(data))); err != nil {
		err = errors.Wrap(err, "writing IDENTIFY body size")
		return
	}

	if _, err = w.Write(data); err != nil {
		err = errors.Wrap(err, "writing IDENTIFY body data")
		return
	}

	return
}
func (c Identify) Write(w *bufio.Writer) (err error) {
	var data []byte

	if data, err = json.Marshal(identifyBody{
		ClientID:       c.ClientID,
		Hostname:       c.Hostname,
		UserAgent:      c.UserAgent,
		MessageTimeout: int(c.MessageTimeout / time.Millisecond),
	}); err != nil {
		return
	}

	if _, err = w.WriteString("IDENTIFY\n"); err != nil {
		err = errors.Wrap(err, "writing IDENTIFY command")
		return
	}

	if err = binary.Write(w, binary.BigEndian, uint32(len(data))); err != nil {
		err = errors.Wrap(err, "writing IDENTIFY body size")
		return
	}

	if _, err = w.Write(data); err != nil {
		err = errors.Wrap(err, "writing IDENTIFY body data")
		return
	}

	return
}
// Write serializes the command to the given buffered output, satisfies the
// Command interface.