csvmap.go
func (r *Reader) Read() (record map[string]string, err error) {
	var rawRecord []string
	rawRecord, err = r.Reader.Read()
	length := min(len(rawRecord), len(r.Columns))
	record = make(map[string]string)
	for index := 0; index < length; index++ {
		column := r.Columns[index]
		if _, exists := record[column]; exists {
			return nil, fmt.Errorf("Multiple indices with the same name '%s'", column)
		}
		record[column] = rawRecord[index]
	}
	return
}
func (r *Reader) Read() (record map[string]string, err error) {
	var rawRecord []string
	rawRecord, err = r.Reader.Read()
	length := min(len(rawRecord), len(r.Columns))
	record = make(map[string]string)
	for index := 0; index < length; index++ {
		column := r.Columns[index]
		if _, exists := record[column]; exists {
			return nil, fmt.Errorf("Multiple indices with the same name '%s'", column)
		}
		record[column] = rawRecord[index]
	}
	return
}
func ( r * Reader ) Read ( ) ( record map [ string ] string , err error ) { var rawRecord [ ] string rawRecord , err = r . Reader . Read ( ) length := min ( len ( rawRecord ) , len ( r . Columns ) ) record = make ( map [ string ] string ) for index := 0 ; index < length ; index ++ { column := r . Columns [ index ] if _ , exists := record [ column ] ; exists { return nil , fmt . Errorf ( " " , column ) } record [ column ] = rawRecord [ index ] } return }
// Read wraps csv.Reader.Read, creating a map of column name to field value.
// If the line has fewer columns than Reader.Columns, the map will not contain keys for these columns;
// thus we can distinguish between missing columns and columns with empty values.
// If the line has more columns than Reader.Columns, Reader.Read() ignores them.
Read wraps csv . Reader . Read creating a map of column name to field value . If the line has fewer columns than Reader . Columns the map will not contain keys for these columns ; thus we can distinguish between missing columns and columns with empty values . If the line has more columns than Reader . Columns Reader . Read () ignores them .