Standard library / bufio

bufio.ErrBadReadCount

Signals a broken Reader returning an impossible byte count to Scanner. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
var ErrBadReadCount error

Working Example

Example Snippetgo
package main
import (  "bufio"  "fmt")
type badReader struct{}
func (badReader) Read(p []byte) (int, error) { return len(p) + 1, nil }func main() {  s := bufio.NewScanner(badReader{})  s.Scan()  fmt.Println(s.Err() == bufio.ErrBadReadCount)}
Go Reference