Skip to content

encoding/csv: add the true number of lines to ErrFieldCount #6770

@btracey

Description

@btracey
In Reader.Read(), if the true record length is not equal to the FieldsPerRecord field,
an ErrFieldCount error is returned. It would be nice if this error also included the
expected and found number of lines. So, for example, instead of the error string being
"wrong number of fields in line", it would be instead "wrong number of
fields in line. 15 read, 10 expected". The specific problem I encountered was that
my csv file had an extra delimiter at the end of the line, so one more record was read
than I expected. If the error message had also listed that there was one more record
than expected it would have been much easier to debug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions