I am working on a program to read from a csv file. I am encountering a strange EOF error and was wondering if there was a way to reset the line cursor of *csv.Reader
to the beginning of the file without creating a new one?
If the io.Reader
you are passing to csv.NewReader
is a io.File
then you can call Seek(0, 0)
on it to reset it back to the start.
Not sure how this will work with CSV though since the parser may already know that it has read the first line. I guess you could skip over that by reading it.