• Justin Nuß's avatar
    encoding/csv: report line start line in errors · 5d14ac74
    Justin Nuß authored
    Errors returned by Reader contain the line where the Reader originally
    encountered the error. This can be suboptimal since that line does not
    always correspond with the line the current record/field started at.
    
    This can easily happen with LazyQuotes as seen in #19019, but also
    happens for example when a quoted fields has no closing quote and
    the parser hits EOF before it finds another quote.
    
    When this happens finding the erroneous field can be somewhat
    complicated and time consuming, and in most cases it would be better to
    report the line where the record started.
    
    This change updates Reader to keep track of the line on which a record
    begins and uses it for errors instead of the current line, making it
    easier to find errors.
    
    Although a user-visible change, this should have no impact on existing
    code, since most users don't explicitly work with the line in the error
    and probably already expect the new behaviour.
    
    Updates #19019
    
    Change-Id: Ic9bc70fad2651c69435d614d537e7a9266819b05
    Reviewed-on: https://go-review.googlesource.com/52830Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    5d14ac74
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...