Standard library / go/scanner

go/scanner.ErrorList

Collection of diagnostic pointers; zero value is ready to use. Expected stdout: '2\n'.

Formal Syntax & Structure

go syntaxgo
type ErrorList []*Error

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/scanner"  "go/token")
func main() {  var es scanner.ErrorList  es.Add(token.Position{Filename: "demo.go", Line: 2, Column: 1}, "second")  es.Add(token.Position{Filename: "demo.go", Line: 1, Column: 1}, "first")  fmt.Println(len(es))}
Go Reference