Standard library / bufio

bufio.ErrNegativeAdvance

Signals a split function incorrectly returned a negative consumed-byte count. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
var ErrNegativeAdvance error

Working Example

Example Snippetgo
package main
import (  "bufio"  "fmt"  "strings")
func main() {  s := bufio.NewScanner(strings.NewReader("a"))  s.Split(func([]byte, bool) (int, []byte, error) { return -1, nil, nil })  s.Scan()  fmt.Println(s.Err() == bufio.ErrNegativeAdvance)}
Go Reference