Standard library / bufio

bufio.Reader.ReadLine()

Low-level line reader without line ending; isPrefix signals a fragment when a line is too long. Returned bytes are transient. Expected stdout: 'ab false <nil>\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Reader) ReadLine() (line []byte, isPrefix bool, err error)

Return Value

(line []byte, isPrefix bool, err error)

Low-level line reader without line ending; isPrefix signals a fragment when a line is too long.

Working Example

Example Snippetgo
package main
import (  "bufio"  "fmt"  "strings")
func main() {  r := bufio.NewReader(strings.NewReader("ab\r\n"))  p, more, e := r.ReadLine()  fmt.Println(string(p), more, e)}
Go Reference