A CSV file is a table of records, and each record is a list of fields. Today you build the smallest possible parser, one that reads a single unpunctuated chunk of text as a table with one record holding one field, so the public surface exists from day one and every later lesson thickens it.
Parse a chunk of text with no commas or newlines into a table of one record holding one field.
Every CSV document is a table: an ordered list of records (the rows), and every record is an ordered list of fields (the cells). That two-level shape, records made of fields, is the whole data model, so the type your parser returns is a list of lists of strings. Start with the smallest input that has any content at all, a single run of characters with no commas and no line breaks. It is one record, and that record has exactly one field.
The one decision worth making now is what empty input means. A file with no
bytes has no rows in it, so parsing "" returns zero records, an empty table,
not a table containing one empty row. Keep that distinction in mind: absence of
any record is different from a record that happens to hold an empty field, which
is a case you will meet very soon. Return a plain list of records for now; the
commas, the newlines, and the quoting all arrive one lesson at a time on top of
this shape.
// records are a slice of records; each record is a slice of string fieldsfunc Parse(input string) [][]string {if input == "" {return [][]string{}}return [][]string{{input}}}