client.go
func (c Client) readMessage() (irc.Message, error) {
	if err := c.conn.SetReadDeadline(time.Now().Add(c.readTimeout)); err != nil {
		return irc.Message{}, fmt.Errorf("unable to set deadline: %s", err)
	}

	line, err := c.rw.ReadString('\n')
	if err != nil {
		return irc.Message{}, err
	}

	log.Printf("client %s: read: %s", c.nick, strings.TrimRight(line, "\r\n"))

	m, err := irc.ParseMessage(line)
	if err != nil && err != irc.ErrTruncated {
		return irc.Message{}, fmt.Errorf("unable to parse message: %s: %s", line,
			err)
	}

	return m, nil
}
func (c Client) readMessage() (irc.Message, error) {
	if err := c.conn.SetReadDeadline(time.Now().Add(c.readTimeout)); err != nil {
		return irc.Message{}, fmt.Errorf("unable to set deadline: %s", err)
	}

	line, err := c.rw.ReadString('\n')
	if err != nil {
		return irc.Message{}, err
	}

	log.Printf("client %s: read: %s", c.nick, strings.TrimRight(line, "\r\n"))

	m, err := irc.ParseMessage(line)
	if err != nil && err != irc.ErrTruncated {
		return irc.Message{}, fmt.Errorf("unable to parse message: %s: %s", line,
			err)
	}

	return m, nil
}
func ( c Client ) readMessage ( ) ( irc . Message , error ) { if err := c . conn . SetReadDeadline ( time . Now ( ) . Add ( c . readTimeout ) ) ; err != nil { return irc . Message { } , fmt . Errorf ( " " , err ) } line , err := c . rw . ReadString ( '\n' ) if err != nil { return irc . Message { } , err } log . Printf ( " " , c . nick , strings . TrimRight ( line , " \r \n " ) ) m , err := irc . ParseMessage ( line ) if err != nil && err != irc . ErrTruncated { return irc . Message { } , fmt . Errorf ( " " , line , err ) } return m , nil }
// readMessage reads a line from the connection and parses it as an IRC message.
readMessage reads a line from the connection and parses it as an IRC message .