A table usually wants every row to have the same number of columns, and a row that does not is often a real data error. Today you add an optional strict mode that catches a ragged row and reports which line broke the shape.
In strict mode, error when a record's field count differs from the first record's, naming the line and counts.
CSV is a table format, and most of the time a well-formed table has the same number of fields in every record. A row with the wrong count usually means something went wrong upstream, an unescaped delimiter, a truncated export, a merged cell, and catching it early beats letting a downstream lookup read the wrong column. So the reader gains an optional strict mode: the first record it reads establishes the expected field count, and any later record that differs is reported as an error.
Make the error specific, because a ragged-row complaint is only useful if it tells you where to look. Name the line of the offending record and both counts, what it got and what it wanted, so the message points straight at the bad row. Keep this opt-in: the default stays permissive and returns ragged rows exactly as they are, because plenty of real CSV is legitimately jagged and a library that refused it would be unusable. This is the same design the field-count checking in mature CSV libraries uses, one remembered number and a per-record comparison.
// add a Strict bool to the reader and a FieldCountError:type FieldCountError struct { Line, Got, Want int }// on the FIRST record, remember its length as the expected count// on each later record when Strict: if len(record) != expected -> return the error// when not Strict: return every record unchanged (ragged rows are allowed)