-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
ReadLine() returns empty line despite a preceding Read() returning os.EOF. package main import ( "encoding/line" "strings" "io/ioutil" "fmt" ) func main() { lr := line.NewReader(strings.NewReader("foo"), 10) _, err := ioutil.ReadAll(lr) if err != nil { fmt.Println(err) return } _, err = lr.Read(make([]byte, 10)) fmt.Println("Read error:", err) _, _, err = lr.ReadLine() fmt.Println("ReadLine error:", err) _, _, err = lr.ReadLine() fmt.Println("ReadLine error:", err) } What is the expected output? Read error: EOF ReadLine error: EOF ReadLine error: EOF What do you see instead? Read error: EOF ReadLine error: <nil> ReadLine error: EOF