Standard library / bufio
bufio.Scanner.Err()
Returns the first non-EOF error encountered. Scan false alone does not distinguish failure from normal completion. Expected stdout: '<nil>\n'.
Formal Syntax & Structure
go syntaxgo
func (s *Scanner) Err() errorReturn Value
error
Returns the first non-EOF error encountered.
Working Example
Example Snippetgo
package main
import ( "bufio" "fmt" "strings")
func main() { s := bufio.NewScanner(strings.NewReader("abc")) for s.Scan() { } fmt.Println(s.Err())}