func (socket *Socket) Read() (string, error) {
	if socket.Closed {
		return "", io.EOF
	}

	lineBytes, err := socket.reader.ReadBytes('\n')

	// convert bytes to string
	line := string(lineBytes[:])

	// read last message properly (such as ERROR/QUIT/etc), just fail next reads/writes
	if err == io.EOF {
		socket.Close()
	}

	if err == io.EOF && strings.TrimSpace(line) != "" {
		// don't do anything
	} else if err != nil {
		return "", err
	}

	return strings.TrimRight(line, "\r\n"), nil
}
// Read returns a single IRC line from a Socket.
Read returns a single IRC line from a Socket.
// Read returns a single IRC line from a Socket .
func (socket *Socket) Read() (string, error) {
	if socket.Closed {
		return "", io.EOF
	}
	lineBytes, err := socket.reader.ReadBytes('\n')
	line := string(lineBytes[:])
	if err == io.EOF {
		socket.Close()
	}
	if err == io.EOF && strings.TrimSpace(line) != "" {
	} else if err != nil {
		return "", err
	}
	return strings.TrimRight(line, "\r\n"), nil
}
func ( socket * Socket ) Read ( ) ( string , error ) { if socket . Closed { return " " , io . EOF } lineBytes , err := socket . reader . ReadBytes ( '\n' ) line := string ( lineBytes [ : ] ) if err == io . EOF { socket . Close ( ) } if err == io . EOF && strings . TrimSpace ( line ) != " " { } else if err != nil { return " " , err } return strings . TrimRight ( line , " \r \n " ) , nil }
Read returns a single IRC line from a Socket.
Read returns a single IRC line from a Socket .
// convert bytes to string // read last message properly (such as ERROR/QUIT/etc), just fail next reads/writes // don't do anything