Golang encoding/csv.ParseError.Error() function example
package encoding/csv
A ParseError is returned for parsing errors. The first line is 1. The first column is 0.
Golang encoding/csv.ParseError.Error() function usage example
package main
import (
"encoding/csv"
"fmt"
"strings"
)
func main() {
// simulate a deformed csv data
csvreader := csv.NewReader(strings.NewReader("item2,item3,item4,item5\nitem6,"))
_, err := csvreader.ReadAll()
if err != nil {
fmt.Println(err.Error())
}
}
Output :
line 2, column 0: wrong number of fields in line
Reference :
Advertisement
Something interesting
Tutorials
+4.8k Facebook : How to place save to Facebook button on your website
+40.5k Golang : Convert to io.ReadSeeker type
+6k Javascript : Get operating system and browser information
+6.1k Fix ERROR 2003 (HY000): Can't connect to MySQL server on 'IP address' (111)
+23.1k Golang : simulate tail -f or read last line from log file example
+9.4k Golang : How to protect your source code from client, hosting company or hacker?
+10.1k Golang : Edge detection with Sobel method
+11k Golang : Create S3 bucket with official aws-sdk-go package
+10.8k Android Studio : Checkbox for user to select options example
+9.2k Golang : How to control fmt or log print format?
+7.4k Golang : Scanf function weird error in Windows
+7.4k Golang : Accessing dataframe-go element by row, column and name example