Standard library / go/scanner

go/scanner.ErrorList.Err()

Returns nil for an empty list, otherwise an error representing the list. Expected stdout: 'true\ntrue\n'.

Formal Syntax & Structure

go syntaxgo
func (p ErrorList) Err() error

Return Value

error

Parsing or setting error; nil on success.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/scanner"  "go/token")
func main() {  var es scanner.ErrorList  fmt.Println(es.Err() == nil)  es.Add(token.Position{}, "bad")  fmt.Println(es.Err() != nil)}
Go Reference