Standard library / encoding/csv
encoding/csv.ErrFieldCount
Sentinel for a record with an unexpected number of fields. Read may return the record alongside the error. Expected stdout: '[c] true\n'.
Formal Syntax & Structure
go syntaxgo
var ErrFieldCount errorWorking Example
Example Snippetgo
package main
import ( "encoding/csv" "errors" "fmt" "strings")
func must(e error) { if e != nil { panic(e) }}
func main() { r := csv.NewReader(strings.NewReader("a,b\nc\n")) _, e := r.Read() must(e) x, e := r.Read() fmt.Println(x, errors.Is(e, csv.ErrFieldCount))}